http://qs1969.pair.com?node_id=918632

santi_h87 has asked for the wisdom of the Perl Monks concerning the following question:

Dear monks, I seek your everlasting wisdom. I am starting to think that Tk and Threads don't mix well... I'll go straight to the point: How can I change a Tk object's property from a different thread? I am using Windows XP Here's my code, I want to set the button's text to "hey" (lower case) from the subrutine thread_sub

use Tk; use threads; use threads::shared; my $mw = new MainWindow(); my $button = $mw->Button(-text => "HEY")->pack(); my $thread = threads->create(\&thread_sub); MainLoop(); sub thread_sub { for (my $i=0; $i<10_000_000; $i++) { # DO NOTHING. LET THE TIME BE TIME } # CHANGE BUTTON'S TEXT PROPERTY TO "hey" HERE }

Thank you, and may the Perl gods be with you.