开发者

How to create a gsignal without parameters in pygtk

The pygtk signal documentation is pretty clear about signals creation, but I could not create a signal that doesn't take parameters.

What I want is to define (like in the example):

class MyGObjectClass(gobject.GObject):
    __gsignals__ 开发者_StackOverflow= {
      "some-signal": (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE),
    }

and then call:

self.emit('some-signal') # not passing any arguments

Currently I can't do this, since the third parameter for gsignal_new is required, and can't be None.


Just use an empty tuple as the third argument.

__gsignals__ = {
  "some-signal": (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()),
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜