bcarroll has asked for the wisdom of the Perl Monks concerning the following question:
Is it possible to execute a callback that is bound to a Tk::Button repeatedly, while the button is pressed?
I tried using the -repeatdelay and -repeatinterval options, but they didn't seem to do any thing.
use warnings; use strict; use Tk; my $num = 0; my $mw = tkinit(); my $button = $mw->Button(-text => $num)->pack(); $button->bind('<Button-1>', \&buttonPressed); $mw->MainLoop(); sub buttonPressed{ #this subroutine should 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: Execute Tk::Button every X interval while button is pressed (and not released)
by bcarroll (Pilgrim) on Feb 13, 2012 at 15:26 UTC | |
by Anonymous Monk on Feb 13, 2012 at 21:04 UTC |