Why is this PyGTK menu empty?

I am working on a PyGTK application with a Gtk.Toolbar. One of the items in taht toolbar is a Gtk.MenuToolButton. However, clicking on the arrow once the program runs results in an empty menu (a tiny white sliver). Here is the code that sets up the menu:

                self.compileMenu = Gtk.Menu()
                self.defaultCompileOption = Gtk.MenuItem(label = "Compile with defaults")
                self.configCompileOption = Gtk.MenuItem(label = "Change compile options...")
                self.compileWithFiles = Gtk.MenuItem(label = "Bundle files...")
                
                self.compileMenu.append(self.defaultCompileOption)
                self.compileMenu.append(self.configCompileOption)
                self.compileMenu.append(self.compileWithFiles)
                
                self.compileButton = Gtk.MenuToolButton(icon_name = "x-package-repository", label = "Compile...", menu = self.compileMenu)

There is also a call to self.toolbar.add at the bottom, to add the MenuToolButton to the toolbar.

1 answer

  • answered 2021-01-19 23:17 Blue

    Found the issue! Turns out that for some reason you need to call, in my case, compileMenu.show_all() to make it realize that you added things to it.