I don't know about afterIdle & afterCancel (haven't needed that
functionality), but I wasn't able to locate the equivalent of the perl/Tk
repeat(), so I use this in Tkx, which uses the Tkx version of after():
# used to implement timer functionality in Tkx, will execute subroutine
$pMy_sub every $millisecs milliseconds if $pEnabled
sub repeat # ( $millisecs, $pMy_sub, $pEnabled )
{
my ( $ms, $pMy_sub, $pEnabled ) = @_;
my $repeater; # repeat wrapper
$repeater = sub
{
Tkx::after($ms, $repeater) if ( $$pEnabled ); #queue
next run before running this instance to minimize timing error accrual
$pMy_sub->(@_);
};
Tkx::after($ms, $repeater);
}
It isn't quite as nice as the Tk repeat(), but it seems to work ok.
Mike
> -----Original Message-----
> From: E.R. Uber [mailto:[email protected]]
> Sent: Friday, January 09, 2009 6:39 PM
> To: Tcl/Tk Mailing List
> Subject: Time Delays in Tkx
>
>
> Are there equivalents in Tkx to the following time delays in Tk:
> $id = $widget->after( $milliseconds, \&callback );
>
> $id = $widget->afterIdle( \&callback );
> $widget->afterCancel( $id );
>
> $widget->repeat( $milliseconds, \&callback );
>
> Thanks
>