Why GUI should use call_soon_threadsafe() when talking to asyncio loop Why GUI should use call_soon_threadsafe() when talking to asyncio loop tkinter tkinter

Why GUI should use call_soon_threadsafe() when talking to asyncio loop


There's no appropriate queue class to use. asyncio.Queue isn't safe to interact with from outside the event loop, and queue.Queue would block the event loop.

If you want to use a queue anyway, you could use asyncio.run_coroutine_threadsafe to call an asyncio.Queue's put method.