Re: Perl Gtk2 simple scheduling

On Sun, 19 Oct 2008 18:17:25 -0700 (PDT)
MICHAEL MCGINN <mmcginn rogers com> wrote:


I have an existing perl Gtk2 application that will run a sub-process based on user initiation(button click) 
and it reports back to an output console as it progresses. This is a consistent activity that happens every 
hour or so.

I'd like to maintain the 'manual' initiation but provide an 'automatic-mode' and have it run the event at a 
pre-determined time (60-90 minute intervals).

What is the best way to do this with perl & Gtk2?


Use a timer.  
Return 1 from the callback to keep the timer going.
Return 0 to end the timer.

I need to refresh (update) a window (in
fact a widget) every X seconds.

my $id = Glib::Timeout->add ($milliseconds, \&timeout_handler);

 sub timeout_handler {
    do_cool_stuff ();
    return $need_to_stay_installed;  # return 0 or 1 to kill/keep timer going


I'm not really a human, but I play one on earth. 

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]