Do you know where your variables are? | |
PerlMonks |
Re: How to change a Tk object's property from a threadby zentara (Archbishop) |
on Aug 05, 2011 at 15:28 UTC ( [id://918805]=note: print w/replies, xml ) | Need Help?? |
Tk is not thread safe, that is why you get the GUI freeze you described in the node above. You cannot directly access a Tk widget from a thread. Workarounds are available. The most foolproof way is to have a shared variable in the thread which gets set to a value signalling the main Tk thread that it's time to change the button text, which ikegami showed. Tk must run a timer to watch that shared variable, here is a simpler version to demonstrate.
I'm not really a human, but I play one on earth. Old Perl Programmer Haiku ................... flash japh
In Section
Seekers of Perl Wisdom
|
|