How can any gtk.Widget (eg. a progress bar) be put into a gtk.Menu as one of the menu items?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Quoting from the PyGTK documentation:
The gtk.MenuItem and its derived widget subclasses are the only valid children of menus.
So the answer is: You can't. But:
As a gtk.MenuItem is a subclass of gtk.Bin it can hold any valid child widget.
If you create a MenuItem without a label:
item = gtk.MenuItem()
you can add most gtk.Widget
subclasses as a child to item
.