Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others


0 votes
in Technique[技术] by (71.8m points)

python - 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.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.

Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.

Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share