pythonpygtkappindicator

Putting other widgets in gtk.Menu


I'd like to be able to put a gtk.ProgressBar in my gtk.Menu, but since menus only takes gtk.MenuItems and its subclasses, what I've done instead is take a plain gtk.MenuItem and tried adding my progress bar as a child to that. Since gtk.MenuItem is a subclass of gtk.Bin, it should be able to hold pretty much any widget.

Example:

menu = gtk.Menu()

item = gtk.MenuItem()

button = gtk.ProgressBar()
button.pulse()
button.show()

item.add(button)
item.show()

menu.append(item)

This runs just fine without pygtk complaining at all. However, my progress bar is simply not shown:

Screenshot of gtk.Menu

If I replace the progressbar with a gtk.Label, it's shown just fine.

Now to my questions:

  1. How do I know which widgets it will take?
  2. How do I trick it into letting me put other widgets in there?

Solution

  • This is a limitation of Ubuntu's Application Indicators, see this question at askubuntu.