[pygtk] gobject timeout when callback is complete

Samuel Cormier-Iijima sciyoshi at gmail.com
Sun Dec 10 07:48:29 WST 2006


I think a better way would be to add an idle callback *inside* the
callback function, so something like

def run_after():
    print 'after'

def run_now():
    print 'now'
    gobject.idle_add(run_after)

gobject.timeout_add(interval, run_now)

... unless I'm mistaking what you want exactly.

Samuel Cormier-Iijima

On 12/9/06, Brian <dol-sen at telus.net> wrote:
> On Sat, 2006-09-12 at 04:22 +0000, John Kelly wrote:
> > Hello everyone,
> >
> > How do i tell gobject to launch a callback after a callback has finished
> > doing whatever it should.
> >
> > In gobject.timeout_add(interval, callback). I basically want the
> > interval to be the time it takes for the callback to finish whatever its
> > doing.
> >
> > How can i do this?
> >
> > John
>
> one way would be to create your own gobject.signal and then at the end
> of your callback, activate that signal.
>
> But, forgive me if I'm seeing your statement wrong.  What you wrote says
> you want to run your callback again as soon as it finishes.  Sounds like
> you should just set it to run inside a loop until you trip a stop flag.
>
>
> go_for it = True
>
> while go_for_it:
>     # do some stuff
>
> then from somewhere else in your program set
>
> go_for_it = False
>
>
> --
> Brian <dol-sen at telus.net>
>
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
>


More information about the pygtk mailing list