You could do it like this:
maweuse Tk; my $FILTER_IS_ON = 0; my $top = new MainWindow(); my $b = $top->Button(-text=>$FILTER_IS_ON ? 'turn off' : 'turn on', -command => \&turn)->pack(); MainLoop(); sub turn { $FILTER_IS_ON = $FILTER_IS_ON ? 0 : 1; $b->configure(-text=> $FILTER_IS_ON ? 'turn off' : 'turn on'); }
In reply to Re: TK: button update
by mawe
in thread TK: button update
by water
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |