[pygtk] Defining and using my own signals

samwyse samwyse at gmail.com
Tue Sep 29 09:07:18 WST 2009


Mystery solved, sort of.

On Sun, Sep 27, 2009 at 9:24 PM, samwyse <samwyse at gmail.com> wrote:

>
> I seem to be missing something.  Here's what I'm doing:
>
> import gobject
> class MyClass(gobject.GObject):
>     def __init__(self):
>         self.__gobject_init__()
>         gobject.type_register(MyClass)
>         gobject.signal_new(
>             'my-signal',
>             MyClass,             gobject.SIGNAL_RUN_LAST,
>             gobject.TYPE_NONE,
>             [])
>

I poked around a bit, and found an example that had the calls to
both type_register and signal_new outside the class.  When I moved my calls
there, everthing worked.  Next, I replaced the call to signal_new with a
__gsignal__ class attribute, which also worked.  Finally, I tried moving the
type_register back into __init__, and everything continued to work
correctly.  I don't think that I'll investigate any further.

Thanks for the assistance, Saeed and Christian!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20090928/e5dbf839/attachment.htm 


More information about the pygtk mailing list