Skip to content

Latest commit

 

History

History
22 lines (18 loc) · 517 Bytes

README.md

File metadata and controls

22 lines (18 loc) · 517 Bytes

asynctk

tkinter的异步版本,使tkinter可以运行或绑定async函数


from asynctk import *

async def main():
    async def hello():
        btn.config(text='running', state='disabled')
        await asyncio.sleep(2)
        btn.config(text='ok', state='disabled')
        await asyncio.sleep(1)
        btn.config(text='start', state='normal')

    root = AsyncTk()
    btn = Button(root, text='start', command=normal(hello))
    btn.pack()
    await root.mainloop()

asyncio.run(main())