Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fluentpython/asyncio-tkinter
Example of running asyncio on top of the Tcl/Tk event loop via Tkinter
https://github.com/fluentpython/asyncio-tkinter
Last synced: 3 days ago
JSON representation
Example of running asyncio on top of the Tcl/Tk event loop via Tkinter
- Host: GitHub
- URL: https://github.com/fluentpython/asyncio-tkinter
- Owner: fluentpython
- Created: 2015-03-18T18:18:13.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-04-05T20:12:21.000Z (over 9 years ago)
- Last Synced: 2024-08-01T22:56:19.336Z (3 months ago)
- Language: Python
- Size: 2.25 MB
- Stars: 65
- Watchers: 9
- Forks: 14
- Open Issues: 5
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
==========================
Using asyncio with Tkinter
==========================The ``tkapp.py`` and ``tkapp2.py`` examples in this folder demonstrate:
- using an alternative ``asyncio.BaseEventLoop`` subclass on top of the Tkinter event loop;
- leveraging futures and ``yield from`` to escape *callback hell*;
- applying the ``asyncio`` abstractions to GUI programming instead of network programming.History
=======The code is adapted from Dino Viehland's (@DinoV) talk `Using futures for async GUI programming in Python 3.3 `_ presented at PyCon US 2013. Dino's example used Tulip because the first release of ``asyncio`` was not available then; some APIs changed later and the ``tkapp.py`` was not working with Python 3.4 and ``asyncio`` from the standard library.
Luciano Ramalho (@ramalho) updated this code to run with Python 3.4 with help and encouragement from Guido van Rossum (@gvanrossum). See relevant thread in the `python-tulip `_ group.
Ramalho also wrote the ``tkapp2.py`` which makes it easier to run the three demonstrations from Viehland's talk: sequential processing, asynchronous with callbacks and asynchronous with coroutines.
Alan Cristhian (@AlanCristhian) fixed the hang-on-exit bug by turning the ``asyncio`` event loop thread into a daemon; see ``guievents.py``, method ``GuiEventLoop._start_io_event_loop``.