I am working on a simple graphical network application using asyncio and tkinter. I ran into the problem of combining an asyncio event loop with Tk mainloop. If possible, I would like to do this without streams, because both of these libraries (but especially tkinter) are not very reliable in streaming mode. I am currently using Tk.update in asyncio coroutine, which only triggers one iteration of the tk event loop:
@asyncio.coroutine def run_tk(tk, interval=0.1): try: while True: tk.update() yield from asyncio.sleep(interval) except TclError as e: if "application has been destroyed" not in e.args[0]: raise
However, in the interest of exploring all the parameters, I was wondering if the opposite could be done if it was possible to call only one iteration of the asyncio event loop inside the tk callback.
python events tkinter tk python-asyncio
Lucretiel
source share