How to put arbitrary widgets into a gtk.Menu?

守給你的承諾、 提交于 2019-12-06 01:04:14

问题


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.



来源:https://stackoverflow.com/questions/4350470/how-to-put-arbitrary-widgets-into-a-gtk-menu

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!