本文介绍了以GTK +连​​接信号:匿名方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

阅读我想知道是否有可能以匿名方式将信号连接到汇?

换句话说,如果下面的例子以上引用的片段):

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

是否可以连接 myCallback 所有的信号引擎启动一次性来源?有些内容符合:

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



当然 gbus 这里只是一个例子。

解决方案

是的,您可以使用()。


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.

解决方案

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

这篇关于以GTK +连​​接信号:匿名方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 10:44