'object' as type worked
Thanks!
Christian

On Sun, Apr 21, 2013 at 7:25 PM, Timo <timomli...@gmail.com> wrote:
> Op 21-04-13 18:55, Christian Mallwitz schreef:
>>
>> Hi,
>>
>> I want to declare a signal handler as in
>>
>> __gsignals__ = {
>>          'foo':        (GObject.SignalFlags.RUN_LAST, None,
>> (GObject.TYPE_POINTER,)),
>>      }
>>
>> I have a do_foo method but the parameter passed is actually a
>> GdkEventButton (or rather a Gdk.EventButton in Python) - the signal is
>> emitted in a 'button-press-event' signal handler.
>>
>> My problem is the event object I have in the 'button-press-event'
>> signal handler and pass when emitting 'foo' is not a
>> GObject.TYPE_POINTER. I tried GObject.TYPE_OBJECT as well to no avail.
>>
>> The error is: TypeError: could not convert type EventButton to
>> gpointer required for parameter 0
>>
>> How do I declare a signal handler such that I can pass a
>> GdkEventButton instance as argument to the signal handler?
>
> I had to do the same when porting an application from GTK2 to GTK3.
>
> GTK2 version:
>     __gsignals__ = {
>         'clicked' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
> (gobject.TYPE_STRING, gtk.gdk.Event))
>     }
>
> GTK3 version:
>     __gsignals__ = {
>         'clicked' : (GObject.SIGNAL_RUN_LAST, None, (str, object))
>     }
>
> I was confused at the beginning because Gdk.Event didn't work anymore, but
> passing it as a Python object seems to do the trick.
>
> Timo
>
>>
>> Thanks
>> Christian
>> _______________________________________________
>> pygtk mailing list   pygtk@daa.com.au
>> http://www.daa.com.au/mailman/listinfo/pygtk
>> Read the PyGTK FAQ: http://faq.pygtk.org/
>
>
> _______________________________________________
> pygtk mailing list   pygtk@daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to