Author Ivan.Pozdeev
Recipients Ivan.Pozdeev, gvanrossum, serhiy.storchaka, terry.reedy
Date 2018-05-04.02:34:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1525401280.09.0.682650639539.issue33412@psf.upfronthosting.co.za>
In-reply-to
Content
Attached a fixed script.

`Tk.after()` works from a worker thread, while `Tk.destroy()` doesn't.

That's because Tkinter implements Tcl calls (_tkinter.c:Tkapp_Call) from another thread by posting an event to the interpreter's queue (Tcl_ThreadQueueEvent) and waiting for result. So a call normally works, but would hang if the interpreter's event loop is not running.

`destroy()`'s Python part (Lib\tkinter\__init__.py:2055) stops the event loop, then makes more Tcl calls -- which hang for the aforementioned reason if made from another thread.
History
Date User Action Args
2018-05-04 02:34:40Ivan.Pozdeevsetrecipients: + Ivan.Pozdeev, gvanrossum, terry.reedy, serhiy.storchaka
2018-05-04 02:34:40Ivan.Pozdeevsetmessageid: <1525401280.09.0.682650639539.issue33412@psf.upfronthosting.co.za>
2018-05-04 02:34:40Ivan.Pozdeevlinkissue33412 messages
2018-05-04 02:34:39Ivan.Pozdeevcreate