[pygtk] gobject.timeout_add()

Pietro Battiston toobaz at email.it
Fri Jan 22 05:56:01 WST 2010


Il giorno gio, 21/01/2010 alle 08.56 +0100, John Stowers ha scritto:
> On Wed, 2010-01-20 at 21:22 -0800, dj wrote:
> > I hope this is the right place to ask this...
> > 
> > I have a python program (using Glade to create the gui) that periodically launches ecasound to make audio recordings of various lengths.  In order to keep the gui viable, ecasound runs in a separate thread.  In order to keep the program from getting ahead of itself and trying to launch ecasound before the current recording process has finished, I use gobject.timeout_add() for the length of the recording (plus a second or two for safety).
> > 
> > Most of the calls to gobject.timeout_add() are in separate functions with different intervals.  All but one of them work.  The last one only works if gobject.timeout_add(..., ...)/return False is appended to the end of the function that needs it, rather than calling it.
> 
> This doesn't sound like a particuarly nice design,

More specifically: are you sure you need threads at all?!
subprocess.call will block the GUI, but subprocess.Popen won't.

Pietro



More information about the pygtk mailing list