18.3. Idle Functions

What if you have a function which you want to be called when nothing else is happening ? Use the function:
 
tag = idle_add(callback, ...)

Any arguments beyond the first (indicated with ...) are passed to the callback in order. The tag is returned to provide a reference to the handler.

This causes PyGTK to call the specified callback whenever nothing else is happening.
 
idle_remove(tag)

I won't explain the meaning of the arguments as they follow very much like the ones above. The callback referred to by the first argument to idle_add() will be called whenever the opportunity arises. As with the others, returning FALSE will stop the idle callback from being called.

The callback should be similar to:
 
def callback(...):

The arguments passed to the callback are the same as those specified in the idle_add() function.