开发者

How to connect the "show" and "hide" signals with PyGTK?

开发者 https://www.devze.com 2023-03-02 02:34 出处:网络
I would like to have a callback called when some widget (a Menu) is shown or hidden. Doing this way :

I would like to have a callback called when some widget (a Menu) is shown or hidden. Doing this way :

menu = gtk.Menu()
menu.connect("show", self.menu_show, menu)
menu.connect("hide", self.menu_hide, menu)

Callback functions are never called. Are show and hide signals the ones I am lo开发者_StackOverflowoking for ? Are they special ? Is there something I am missing to have this working ?


I think those signals are emitted only when the respective methods on an object are called. If you want to connect to when a widget is (re-) drawn, take the expose-event signal. But why do you want to anyway? A menu is there to provide to the user choices for actions, not to run some setup/teardown code when it is shown/hidden.

0

精彩评论

暂无评论...
验证码 换一张
取 消