Table of Contents
You may be wondering how you make GTK do useful work when in
main(). Well, you have several options. Using the
following gobject module function you can create a timeout function that
will be called every "interval" milliseconds.
source_id = gobject.timeout_add(interval,function, ...)
The interval argument is the number of
milliseconds between calls to your function. The
function argument is the callback you wish to have
called. Any arguments after the second are passed to the function as
data. The return value is an integer "source_id" which may be used to stop
the timeout by calling:
gobject.source_remove(source_id)
You may also stop the timeout callback function from being
called again by returning zero or FALSE from your
callback. If you want your callback to be called again, it should return
TRUE.
Your callback should look something like this:
def timeout_callback(...):
The number of arguments to the callback should match the number
of data arguments specified in timeout_add().