[pygtk] gobject.idle_add and generators
skip at pobox.com
skip at pobox.com
Thu May 1 10:35:16 WST 2008
Sorry, kind of new to the idea of using simple generators in place of
regular functions, but I think I have the classic "need to save intermediate
state" case which would make it worthwhile. The current function-based
approach I'm using is pretty cumbersome. Suppose g is a simple generator:
def g():
while True:
do_something_useful()
yield True
Does it make sense to call it like this?
gobject.idle_add(g)
If I want to terminate the idle execution I suppose I'd have to arrange to
yield False instead of True, just as with a regular function, yes?
Thx,
--
Skip Montanaro - skip at pobox.com - http://www.webfast.com/~skip/
"There's a fine line between a hobby and a mental illness." Ande Rasmussen
More information about the pygtk
mailing list