in reply to Execute Tk::Button every X interval while button is pressed (and not released)
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++); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Execute Tk::Button every X interval while button is pressed (and not released)
by Anonymous Monk on Feb 13, 2012 at 21:04 UTC |