Re: updating (refreshing) a window or widget
- From: "muppet" <scott asofyet org>
- To: gtk-perl-list gnome org
- Subject: Re: updating (refreshing) a window or widget
- Date: Wed, 22 Jun 2005 09:50:47 -0400 (EDT)
Blitzkrieg said:
I need to refresh (update) a window (in
fact a widget) every X seconds.
$id = Glib::Timeout->add ($milliseconds, \&timeout_handler);
sub timeout_handler {
do_cool_stuff ();
return $need_to_stay_installed;
}
http://gtk2-perl.sourceforge.net/doc/pod/Glib/MainLoop.html#integer_Glib_Timeout
http://developer.gnome.org/doc/API/2.0/glib/glib-The-Main-Event-Loop.html#g-timeout-add
This will require a rework of your Tk code, as you need to ensure that the
main loop has control in order for the timeout to fire, but personally i find
the Tk model rather confusing.
So, using Gtk2::Window and Gtk2::SimpleList how should i do refresh the
list, every X seconds, and in the meanwhile receive data from a daemon
(i don't want the exact code, but the idea and some examples or docs
about the api used)? Could you point me to some documentation sources
other than gtk2-perl.sourceforge.net/doc/ ?
Similarly, you can use Glib::IO->add_watch() to tell glib's main loop to poll
a file descriptor, and invoke a callback when data arrives. That, coupled
with a timeout, is the traditional way to achieve what you want.
http://live.gnome.org/GTK2_2dPerl_2fFrequentlyAskedQuestions#head-3b88c68683fd189b09455a462d5e41669b7b1142
http://gtk2-perl.sourceforge.net/doc/pod/Glib/MainLoop.html#integer_Glib_IO_add_
http://developer.gnome.org/doc/API/2.0/glib/glib-IO-Channels.html#g-io-add-watch
--
muppet <scott at asofyet dot org>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]