Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion async_tkinter_loop.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _tkinter
import asyncio
import tkinter
from functools import wraps
Expand All @@ -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

Expand Down