[pygtk] Using a CheckButton on an applet Menu

Adolfo González Blázquez agblazquez at telefonica.net
Fri Apr 7 09:23:05 WST 2006


Hello,

I'm writing a gnome applet using pygtk, and I need to add a CheckButton
to the applet menu (something like the play item on rhythmbox tray icon
context menu).

To create the applet menu, i use the method 'setup_menu' [1], which
comes in the 'applet' module from python-desktop.

What I need is a way to change the menu item from check activated to
deactivated when clicking on it.

The menu creating code is:
-------------------------------------------
self.verbs = [("Alarm", self.menu_alarm_toggled), 
("Log", self.menu_log_toggled), 
("Prefs", self.prefs.preferences_show), 
("About", self.about_info)]

self.applet.setup_menu_from_file (glob.resources_dir,
"laptoptemp_menu.xml", "laptoptemp", self.verbs)
-------------------------------------------

The .xml file for the menu is:
-------------------------------------------
<Root>
	<popups>
	<popup name="button3">
		<menuitem name="Alarm" verb="Alarm" _label="_Enable alarm?"
pixtype="stock" pixname=""/>
		<menuitem name="Log" verb="Log" _label="_Enable logging?"
pixtype="stock" pixname=""/>
		<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"/>
	</popup>
	</popups>
</Root>
-------------------------------------------

		
Thanks in advance for any help!

-- adolfo		

[1]
http://developer.gnome.org/doc/API/2.0/panel-applet/panelapplet.html#PANEL-APPLET-SETUP-MENU
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada
	digitalmente
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20060407/51062a05/attachment.pgp


More information about the pygtk mailing list