in reply to displaying program status in perl tk

Whenever you want something done automatically on a schedule, use a timer
sub count { print "$upper_no\n"; my $timer; # declare first so you # can cancel it in it's own callback $timer = $mw->repeat(1000,sub{ $no++; if ($no >= $upper_no){ $timer->cancel } }); }

I'm not really a human, but I play one on earth Remember How Lucky You Are

Replies are listed 'Best First'.
Re^2: displaying program status in perl tk
by jagdish.eashwar (Novice) on Feb 05, 2009 at 07:51 UTC
    Hi,
    Thank you every one for your responses. I tried all that was suggested to the best of my understanding, but couldn't get the display of the program status in real time. I hope I'm not speaking too soon, but I think I've finally found an answer in the 'Perl Tk and the Web' chapter of 'Mastering Perl Tk'. I have to use '$mw->idletasks;' in my while loop.
      If you need idletasks in your loop, and the timer I showed you dosn't work right to show your updates, then I must presume you are not showing us the real code. You might try putting $mw->update; in your loop too, that may help, but it's a bad design.

      If you would show us your real code, we probably could show you a better way.


      I'm not really a human, but I play one on earth Remember How Lucky You Are