[pygtk] Defining and using my own signals
Saeed Rasooli
saeed.gnu at gmail.com
Mon Sep 28 08:44:51 WST 2009
import gobject
gobject.type_register(MyWidgetClass)
gobject.signal_new('my-signal-name', MyWidgetClass,
gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, [])
In the MyWidgetClass, use:
self.emit('my-signal-name')
to emit that signal. And if you defined arguments for that
signal(using gobject.signal_new) give that arguments to emit function.
for example:
gobject.signal_new('my-signal-name', MyWidgetClass,
gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, [int, str])
self.emit('my-signal-name', 5, 'test') ## two arguments [int, str]
On 9/27/09, samwyse <samwyse at gmail.com> wrote:
> I writing a pygtk app that will use a plug in architecture. I'm thinking
> about reusing the existing signal mechanisms to trigger the plug-ins at the
> appropriate times. The tutorials don't go into how to define your own
> signals. Can anyone enlighten me? Thanks.
>
More information about the pygtk
mailing list