VIdeo Converence Software: Tk and thread synchronization

Paul Rubin http
Tue Oct 3 03:43:28 EDT 2006


"Eric Brunel" <eric_brunel at despammed.com> writes:
> General answer: no, it isn't. The only thing that seems to work
> everytime  on tk widgets from secondary threads is generating events
> as above. 

I wouldn't bet on even that always being safe.

> If you try to do anything else, you may experience deadlocks or even
> crashes.

The way I do it is use a .after event in the main tkinter loop
to check a queue every 20 msec or so.  Other threads send commands
through the queue.  I usually pass commands as tuples (func, *args, **kw)
so that the .after handler simply calls the func on the args.



More information about the Python-list mailing list