PilotinControl has asked for the wisdom of the Perl Monks concerning the following question:
Good Evening Monks!
I've posted a snippet of code that I need a Tk Button each time that it is pressed to do a different function. In this instance F0 button each time it is pressed it will turn ON the lights and then turn OFF the lights. The serial port code works....the button code does not reflect that. Thanks for pointing me in the right direction.
sub btnpress { my $btn = shift; if($btn eq 'C') { $display = ''; $buffer = ''; $dbuffer = ''; } if( $btn =~/F0/ ) { $display = sprintf "0 - Lights On", $dbuffer; $mw->bind('<ButtonPress-1>', \&one); } else { display($btn); } } sub one { $display = sprintf "0 - Lights Off", $dbuffer; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tk Button Press
by SuicideJunkie (Vicar) on Nov 02, 2015 at 15:39 UTC | |
|
Re: Tk Button Press (more global variables)
by Anonymous Monk on Nov 02, 2015 at 07:53 UTC |