[pygtk] trouble creating a gtk.MenuToolButton

Eike Nicklas lists at ephys.de
Sun Mar 23 17:29:34 WST 2008


On Sat, 22 Mar 2008 20:53:25 -0700 John Finlay wrote:
> Eike Nicklas wrote:
> > Hi list,
> >
> > I am trying to populate a gtk.MenuToolButton with a menu. Since
> > uimanager sadly seems to have no support for menutoolbuttons, I am
> > trying to create one by hand with (complete code attached):
> >
> > menubutton = gtk.MenuToolButton(gtk.STOCK_PREFERENCES)
> > menu = gtk.Menu()
> > menu_item = gtk.MenuItem('some menu item')
> > menu.append(menu_item)
> > menubutton.set_menu(menu)
> > toolbar = gtk.Toolbar()
> > toolbar.insert(menubutton, 0)
> >
> > The button shows up fine, but the drop-down menu is empty. What am I
> > missing?
> >
> >   
> menu_item.show()
> 

Indeed, thanks a lot! I thought this wasn't necessary because of the
later use of window.show_all().

Eike



More information about the pygtk mailing list