Re: Perl/Tkx equivalent to Perl/Tk's 'repeat'

[email protected] (Michael Carman)
Newsgroups perl.tcltk
Message-ID <2049140462.6504171267031855463.JavaMail.root@dsmdc-mail-mbs13>
"Swingle David-QWHM86" <[email protected]> wrote:
> In the following code snippet, I use 'repeat' to call a subroutine
> (UpdateCurrentProgress()) once every 100ms.  Is there something
> equivalent in Perl/Tkx?

No, but it's easy to roll your own:

    # Emulate Perl/Tk's repeat() method
    sub repeat {
        my $ms  = shift;
        my $sub = shift;
        my $repeater; # repeat wrapper
        
        $repeater = sub { $sub->(@_); Tkx::after($ms, $repeater); };
        
        Tkx::after($ms, $repeater);
    }

And then use it like this:

    repeat(100, \&UpdateCurrentProgress);

-mjc
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.