diff --git a/async_tkinter_loop.py b/async_tkinter_loop.py index 47c5065..536b15a 100644 --- a/async_tkinter_loop.py +++ b/async_tkinter_loop.py @@ -1,3 +1,4 @@ +import _tkinter import asyncio import tkinter from functools import wraps @@ -13,9 +14,12 @@ async def main_loop(root: tkinter.Tk) -> None: :return: nothing """ while True: + # Process all pending events + while root.dooneevent(_tkinter.DONT_WAIT): + pass + try: root.winfo_exists() # Will throw TclError if the main window is destroyed - root.update() except TclError: break