OSDir


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Python-Dev] Use a queue in Tkinter (was: Dealing with tone in an email)


On 5/6/2018 8:51 AM, Stefan Krah wrote:
> 
> Steven D'Aprano wrote:
>>> What exactly didn't work? I don't understand.
>>
>> https://bugs.python.org/issue33412
> 
> Isn't the standard solution to use a queue for updating the GUI?
> 
> At least I didn't have any problems at all with my one TKinter app, I
> think the method is described in the Python Cookbook.

The 2nd edition, Recipe 11.9 Combining GUIs and Asynchronous I/O with 
Threads gives an example that processes items in the queue 5 times a 
second.

I can understand the desire to avoid the put and get overhead and the 
poll wait by calling a gui method directly.  This works when one uses 
tcl/tk compiled with thread support and avoids inter-thread deadlocks. 
See my answer to Chris A. for details.

-- 
Terry Jan Reedy