This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Integrating tkinter and asyncio event loops
Type: Stage: resolved
Components: Tkinter Versions: Python 3.11
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Integrate tkinter and asyncio (and async)
View: 27546
Assigned To: Nosy List: serhiy.storchaka, skip.montanaro, terry.reedy
Priority: normal Keywords: patch

Created on 2022-04-01 17:18 by skip.montanaro, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
tkasyncio.py skip.montanaro, 2022-04-01 17:18
Pull Requests
URL Status Linked Edit
PR 32293 open skip.montanaro, 2022-04-03 21:43
Messages (5)
msg416500 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2022-04-01 17:18
After looking around and asking, it appears there is no built-in integration of the tkinter and asyncio event loops. That would seem to be a good thing, at least as an example. I wrote a simple hello world which creates an AsyncTk class and uses asyncio-driven event handling. This is clearly incomplete, but might be a useful starting point, even if just as a seed for discussion or as an example for tkinter or asyncio documentation.

Discussion/thread references:

https://mail.python.org/pipermail/python-list/2022-March/905783.html
https://discuss.python.org/t/connecting-asyncio-and-tkinter-event-loops/14722/7

The code in its most basic form is attached. (I have another version which uses pynput to track keyboard and mouse events.)
msg416534 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2022-04-02 03:03
I did some somewhat similar experiments a few years ago.  I will try to find the code sometime.
msg416655 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2022-04-04 07:17
It is a duplicate of issue27546.
msg416669 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2022-04-04 13:45
That's fine. My brief search didn't turn up

https://bugs.python.org/issue27546

I'm happy to close this.
msg416696 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2022-04-04 20:51
That issue has my previous experiments.  Thank you Serhiy for finding it ;-).
History
Date User Action Args
2022-04-11 14:59:57adminsetgithub: 91346
2022-04-04 20:51:42terry.reedysetsuperseder: Integrate tkinter and asyncio (and async)
resolution: duplicate
messages: + msg416696
2022-04-04 13:45:21skip.montanarosetstatus: open -> closed

messages: + msg416669
stage: patch review -> resolved
2022-04-04 07:17:01serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg416655
2022-04-03 21:43:38skip.montanarosetkeywords: + patch
stage: patch review
pull_requests: + pull_request30355
2022-04-02 03:03:40terry.reedysetnosy: + terry.reedy
messages: + msg416534
2022-04-01 17:18:03skip.montanarocreate