Connecting signals in GTK+: anonymous way?

别说谁变了你拦得住时间么 提交于 2019-12-25 04:55:07

问题


After reading "Using your signals" I am wondering if it is possible to connect the signals to "sinks" in an "anonymous" way?

In order words, if the example following (snippet from reference above):

aCar = Car()
aCar.connect('engine-started', myCallback) 

Is it possible just to connect myCallback to all the signal engine-started sources in one go? Something along the lines of:

gbus.connect('engine-started', myCallback)

Of course gbus here is just an example.


回答1:


Yes, you can use gobject.add_emission_hook (g_signal_add_emission_hook).



来源:https://stackoverflow.com/questions/2074372/connecting-signals-in-gtk-anonymous-way

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