[pygtk] Toggle menu item and toggle button syncronized
Stephen Langer
stephen.langer at nist.gov
Thu May 4 21:57:48 WST 2006
On May 4, 2006, at 9:47 AM, Adolfo González Blázquez wrote:
> The problem comes when cliking the menu item, i try to activate the
> button, and this catch the 'clicked' signal, so it tries to
> activate the
> menu, and that si a kind of infinite loop.
> Maybe i'm not explaining myself clearly...
>
> The code is like this:
signal = button.connect('clicked', on_button_play_clicked)
>
> def on_menu_play_clicked(self, widget):
> self.playing = not self.playing
button.handler_block(signal)
> self.button_play.set_activated(self.playing)
button.handler_unblock(signal)
> self.play()
>
> def on_button_play_clicked(self, widget):
> self.playing = not self.playing
> self.play()
--
-- EMail: stephen.langer at nist.gov Phone: (301)
975-5423 --
-- WWW: http://math.nist.gov/mcsd/Staff/SLanger/ Fax: (301)
975-3144 --
-- Mail: NIST; 100 Bureau Drive -- Stop 8910; Gaithersburg, Md
20899-8910 --
-- "I don't think this will work. That's why it's
science." --
-- Naomi Langer, 17 Feb
2003 --
More information about the pygtk
mailing list