[pygtk] Using a CheckButton on an applet Menu

Gustavo J. A. M. Carneiro gjc at inescporto.pt
Wed Oct 11 20:31:29 WST 2006

On Qua, 2006-10-11 at 14:07 +0200, Adolfo González Blázquez wrote:
> Hello,
> I sent an email [1] to this list about this problem in april, but got no
> responses. I'm thinking now of trying to implement this in my applet, so
> that's why i'm asking again.
> The problem is that i have an applet [2], using the gnomeapplet pygtk
> module. I build the applet context menu using the
> gnomeapplet.setup_menu_from_file function, passing it a .xml file like
> this:
> <Root>
> 	<popups>
> 	<popup name="button3">
> 		<menuitem name="Alarm" verb="Alarm" _label="_Enable alarm"
> pixtype="stock" pixname="gtk-apply"/>
> 		<separator/>
> 		<menuitem name="Prefs" verb="Prefs" _label="_Preferences"
> pixtype="stock" pixname="gtk-properties"/>
> 		<menuitem name="About" verb="About" _label="_About" pixtype="stock"
> pixname="gnome-stock-about"/>
> 		<menuitem name="Prueba" verb="Prueba" _label="Prueba" type="toggle"/>
> 	</popup>
> 	</popups>
> </Root>
> And i catch the signals from the menu options using this:
> self.verbs = [("Alarm", self.menu_alarm_toggled),
> 	("Prefs", self.prefs.preferences_show), 
> 	("About", self.about_info),
> 	("Prueba", self.prueba)]
> self.applet.setup_menu_from_file (glob.resources_dir,
> 		"computertemp_menu.xml", "computertemp", self.verbs)
> Ths signals for the normal menu items (About, Prefs, Alarm) work ok, but
> i can't catch the signal for the toggle menu item.
> Has anybody idea of how to catch this signal??

  You need to connect to the 'ui-event' signal of the UIComponent.


Gustavo J. A. M. Carneiro
<gjc at inescporto.pt> <gustavo at users.sourceforge.net>
The universe is always one step beyond logic.

More information about the pygtk mailing list