I figured it out, without having to bind a callback to the button (using the "-command" option)
use warnings; use strict; use Tk; my $num = 0; my $mw = tkinit(); my $button = $mw->Button( -text => $num, -repeatdelay => 25, -repeatinterval => 25, -command => sub{ buttonPressed(); } )->pack(); $mw->MainLoop(); sub buttonPressed{ #this subroutine will be executed if the button is clicked once, #or repeatedly executed if the button is held down. print "."; $button->configure(-text => $num++); }
In reply to Re: Execute Tk::Button every X interval while button is pressed (and not released)
by bcarroll
in thread Execute Tk::Button every X interval while button is pressed (and not released)
by bcarroll
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |