[pygtk] Controlling a menu structure from an XML file?

Geoff Bache geoff.bache at jeppesen.com
Thu Mar 8 19:00:58 WST 2007


Hello,

I'm wondering about defining a menu structure using gtk.UIManager and an 
XML file. What confuses
me a bit is that it seems to be necessary to define which menus and 
submenus I have in the Python code,
even if I can then control their contents from XML. The reason seems to 
be that everything has to have
an "action".

I define a menu like this:

<menu action="actionsmenu">
      <menuitem action="Select"/>
      <menuitem action="Run"/>
</menu>

But for this to work I have to write (somewhere in my Python code)

menuAction = gtk.Action("actionsmenu", "_Actions", None, None)
...

just in order to translate the identifier "actionsmenu" into the label 
"_Actions".

I'd like to be able to write something like

<menu label="_Actions>

so that I can define the whole menu structure in one format in one 
place. Is this possible in some way?

Regards,
Geoff Bache



More information about the pygtk mailing list