On Tue, 2003-09-09 at 12:43, Christian Reis wrote: > How do you avoid having set_active() emitting the toggle signal every > time it's triggered? I'm trying to figure out how that would not loop > recursively. Let's see: > > A -> C > B -> C > C -> A, B -> C (loop) > > Then again, it may just loop once and then stop if > > set_active(1) > set_active(1) > set_active(1) > > only emits a signal on the first time. Ah, that must be it. :-)
There must be some kind of automatic semaphore. I expanded my routine to
this:
def run_button_toggled(self, widget, event=None):
print "Toggle called with %s" % (type(widget))
x = widget.get_property('active')
self.world.set_running( x )
print "Calling set_active..."
self.widget['togglebutton'].set_active(x)
self.widget['run1'].set_active(x)
print "Done."
----------------------
And get this, when I hit CTRL-R, or press the button:
----------------------
Toggle called with <type 'gtk.CheckMenuItem'>
Calling set_active...
Toggle called with <type 'gtk.ToggleButton'>
Calling set_active...
Done.
Done.
-----------------------
So there is some recursion happening, but it apparently gets limited.
Now I'm wondering if this is indeed safe to do, or just a happy
coincidence. Does anyone know if this is intentional behaviour?
Thanks,
cf
--
Colin Fox <[EMAIL PROTECTED]>
CF Consulting Inc.
signature.asc
Description: This is a digitally signed message part
_______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
