timtrust123
Programmer
I would like the text on a button to update while a sub is running. I have linked the button text to a variable in the example below hoping it would update during the sub but it does not. How can I update the button text during the sub running. (i'm using win NT )
use Tk;
$info = "start";
$mw = MainWindow->new;
$i = 0;
$b = $mw->Button(-text=> $info)->pack();
$b->configure (-command => \&push_button);
MainLoop;
sub push_button
{
$i = 0;
while ($i < 1000000){$i++}
$info = "first stage";
$i = 0;
while ($i <100000){$i++}
$info = "second stage";
$i = 0;
while ($i <100000){$i++}
$info = "third stage";
print "done\n$info";
}
use Tk;
$info = "start";
$mw = MainWindow->new;
$i = 0;
$b = $mw->Button(-text=> $info)->pack();
$b->configure (-command => \&push_button);
MainLoop;
sub push_button
{
$i = 0;
while ($i < 1000000){$i++}
$info = "first stage";
$i = 0;
while ($i <100000){$i++}
$info = "second stage";
$i = 0;
while ($i <100000){$i++}
$info = "third stage";
print "done\n$info";
}