Tk not displaying correctly
Paul Rubin
http
Wed Dec 21 17:42:19 EST 2005
"Tuvas" <tuvas21 at gmail.com> writes:
> What (I think) will happen is when you hit the button, until x=100, the
> display will stop updating, and when the command has left it's thread,
> it will return to updating again. Is there a way to make it so it
> always will update, irreguardless if it's in a seporate thread, perhaps
> calling a new thread that calls mainloop? Thanks!
Yes, you have to call mainloop in the separate thread. Be careful
because tkinter is not thread safe. You have to communicate with the
gui thread through some synchronized mechanism like queues. I usually
use the w.after operation to make a polling loop that checks a queue
for gui-updating events. The events themselves are just callables
that do gui operations when called.
More information about the Python-list
mailing list