gaah, I forgot to add some explanatory word. didn't mean to sound rude.

On Wed, 2008-09-24 at 12:12 +0100, Emmanuele Bassi wrote:
> On Wed, 2008-09-24 at 07:01 -0400, Pierre-Luc Beaudoin wrote:
> 
> > Actually, that's not clear from what I gave you, but you can call
> > idle_add directly on "gobject":
> > 
> > import gobject
> > 
> > if __name__ == '__main__':
> >     #here or anywhere else btw
> >     gobject.idle_add(on_idle, data)
> 
>         clutter.main()

you need clutter.main() - or any other GLib main loop - otherwise the
idle handlers (like the timeout handlers) will not run.

> > 
> > def on_idle(self, data):
> >     #do something
>         return False   # to remove the idle handler
>                        # from the main loop; True will
>                        # keep it attached

I never remember what's the default behaviour of python, here; Perl
would take the return value for the last function and put it on the
stack as the return value for the function - so:

  sub on_idle {
      # do something
  }

would return what the last function of the block returned, even without
an explitic return. this can be confusing and lead to weird bugs.

in any case, always put a return value for your idle, timeout and event
handlers.

ciao,
 Emmanuele.

-- 
Emmanuele Bassi, Intel Open Source Technology Center

-- 
To unsubscribe send a mail to [EMAIL PROTECTED]

Reply via email to