in reply to Simple Tkx loop question

I don't do Tkx, but the thing you want to do is use a millisecond timer. Like
my $timer = $mw->repeat( 3000, \&my_routine(); # will do it every 3 seconds Tkx::MainLoop(); exit;

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku

Replies are listed 'Best First'.
Re^2: Simple Tkx loop question
by DreamT (Pilgrim) on Feb 23, 2010 at 11:49 UTC
    Unfortunately it didn't work;
    bad option "repeat": must be cget or configure at Ikon.pl line 82.
    I guess that there's a equivalent for Tkx?
    The closest I got was http://www.mail-archive.com/tcltk@perl.org/msg00220.html . Maybe that's correct?
      You just gave some pseudo code, and so did I. I don't have Tkx running, nor have knowledge of it's exact syntax. You asked how do I get this running in the mainloop. The answer is a timer.... how Tkx implements timers is up to you to find out. Maybe google for "perl Tkx timer", the first hit shows how to do it.... they call it a Tkx::after

      I'm not really a human, but I play one on earth.
      Old Perl Programmer Haiku
        Something like the following will work:
        # After 100ms call my_routine(). Tkx::after(100, sub { my_routine(); }); Tkx::MainLoop();

        Also, if you need a good tutorial on Tkx, check out

        http://www.tkdocs.com/tutorial/

        There are lots of examples and each example is shown in Tcl, Ruby, Perl, and Python.