Leser: 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
use strict; use Tk; my $mw = MainWindow->new(); my $button = $mw->Button(-text => "do it", -command => \&callback ); my $var = "Waiting ..."; my $lab = $mw->Label(-textvariable => \$var); $lab->pack(); $button->pack(); MainLoop; sub callback { $var = "INFO: step 1, please wait ...\n"; $lab->configure(-textvariable => \$var); sleep 2; $var = "INFO: step 2, please wait ...\n"; $lab->configure(-textvariable => \$var); sleep 2; }
1 2 3 4 5 6 7 8 9 10
sub callback { $var = "INFO: step 1, please wait ...\n"; $lab->configure(-textvariable => \$var); $lab->update; sleep 2; $var = "INFO: step 2, please wait ...\n"; $lab->configure(-textvariable => \$var); $lab->update; sleep 2; }