Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mityax/asynctkinter
Integrate python's built-in tkinter library with the asyncio framework
https://github.com/mityax/asynctkinter
Last synced: about 2 months ago
JSON representation
Integrate python's built-in tkinter library with the asyncio framework
- Host: GitHub
- URL: https://github.com/mityax/asynctkinter
- Owner: mityax
- Created: 2020-06-16T15:29:48.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-06-16T15:40:35.000Z (over 4 years ago)
- Last Synced: 2024-10-15T15:22:58.335Z (3 months ago)
- Language: Python
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# asynctkinter
Integrate python's built-in tkinter library with the asyncio framework. This module also contains a simple
workaround to bypass tkinter's master-child-window restrictions (that you always have to have exactly one root window).## Installation
Just copy the "asynctkinter.py" file into your project and import it.
This module only works for Python 3.## Usage
Basic usage is simple:
```python3
import asyncio
import asynctkinter as atkasync def my_background_task():
while True:
print("This runs too, concurrently!")
await asyncio.sleep(1)async def main():
asyncio.create_task(my_background_taks())win = atk.Tk(title="My Window!")
await win.mainloop()asyncio.run(main())
```
Asynctkinter also contains some utilities for custom events and asynchronous callbacks. Just take a look at the source code, it's all well documentated and clear and contains more usage examples.