[pygtk] Adding menu items at runtime

Alessandro Dentella sandro at e-den.it
Sat Jun 6 01:28:11 WST 2009


On Wed, Jun 03, 2009 at 01:01:44PM +0200, Johannes Bauer wrote:
> Hello list,
> 
> I have a Pyton application which reads in some plugins and needs to add
> items to a "plugins" menu accordingly at runtime. Now I expected to to a
> builder/get for the MenuItem parent entry and then use "add" (as
> MenuItem inherits from Bin).
> 
> But - weird: Although in the glade-File I see my "Plugins_MenuItem" as
> of type "GtkMenuItem", in the generated XML it is of type "GtkAction"
> (and is so also during runtime). I cannot add children to a GtkAction,
> however...

I don't use glade, so I can't be of help with that, but testing it with
glade I don't get GtkAction entries. 

I only recently started using the gtk.UIManager() object and that's in my
opinion the better way to go if you want a simple and dynamic solution.

sandro
*:-)


More information about the pygtk mailing list