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, ()),
}
精彩评论