coderama has asked for the wisdom of the Perl Monks concerning the following question:
use Tk; my $number = 0; my $mw = tkinit(); my $button = $mw->Button(-text => 'Button')->pack(-side => 'left'); my $label=$mw->Label(-textvariable=>\$number)->pack(-side=>'left'); my $timer = $mw->repeat(100, sub{ $number = int(rand(5)); if ( $number == 1 ){ $button->configure(-state => 'normal'); } else { $button->configure(-state => 'disabled'); } }); $mw->MainLoop();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Change the state of Tk::Button widget based on a variable?
by zentara (Cardinal) on Sep 28, 2011 at 16:51 UTC |