in reply to Perl/Tk repeat method, callback doesn't work if...
First, Tk::repeat is a quick shortcut for Tk::after, read "perldoc Tk::after". Look thru Tk::after's methods to see if there is something you can use. Second, you didn't show a complete code example, but with Tk timers, if you declare them BEFORE you create them, you can use their variable name within the callback, like:
#pseudocode my $timer; # code update line below, I forgot to define $timer $timer = $mw->repeat( 50, { #you can use $timer here if $whatever, $timer->cancel; } ); # declare outside the callback, otherwise a $timer cannot cancel itsel +f
If you really want to get into a select style usage, within Tk, it dosn't work well, because it will interfere with the eventloop. But there is a workaround. See Tk::Trace in Simple Tk Gauge
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl/Tk repeat method, callback doesn't work if...
by NewMonkMark (Initiate) on May 17, 2011 at 08:40 UTC | |
by NewMonkMark (Initiate) on May 17, 2011 at 09:34 UTC | |
by zentara (Cardinal) on May 17, 2011 at 16:50 UTC | |
by NewMonkMark (Initiate) on May 19, 2011 at 16:39 UTC | |
by zentara (Cardinal) on May 19, 2011 at 18:10 UTC |