[pygtk] right-click menu in an applet

Davide Alberani davide.alberani at gmail.com
Sun Sep 13 19:12:32 WST 2009


I'm trying to set some attributes ("sensitive" and "state" for some
radio buttons) on a menu defined in a XML file, but my 'cmd' tags
are ignored.
Below a simple example, with the applet put inside a normal window
for easier debugging.

I suppose I'm doing something wrong in the XML or maybe I forget to
call some method of the applet instance.
Does anyone have a working example of a "non sensitive" menu entry
created using a XML specification?
Extra points for an example with a bunch of radio buttons in a group,
with one (that is not the first one) pre-selected. :-)

TIA.

=================================================================

#!/usr/bin/python

import gtk
import gnomeapplet

XML = """
<Root>
  <commands>
    <cmd name="baa" sensitive="0" />
  </commands>
  <popup name="button3">
    <menuitem name="baa" verb="baa" label="My Label" />
  </popup>
</Root>
"""

window = gtk.Window(gtk.WINDOW_TOPLEVEL)
window.set_size_request(200, 200)

applet = gnomeapplet.Applet()
applet.setup_menu(XML, [], None)
applet.reparent(window)

window.show_all()

gtk.main()


=================================================================

-- 
Davide Alberani <davide.alberani at gmail.com> [GPG KeyID: 0x465BFD47]
http://erlug.linux.it/~da/


More information about the pygtk mailing list