FAQ Index - Search - Recent Changes - Everything - Add entry

<< Previous Entry | FAQ Entry 20.7 | Next Entry >>

20.7. I set up a timeout handler using timeout_add, but the handler only runs once.

When using a timeout handler:

 def on_timeout(self, *args):
   print "Ping", args 

 gobject.timeout_add(1000, on_timeout)
If you fail to return True in the timeout handler, it will only run once. Therefore:

 def on_timeout(self, *args):
   print "Ping", args 
   return True
will run the timeout handler every 1s.

PyGTK FAQ Wizard | PyGTK Homepage | Feedback to faq at pygtk.org