[pygtk] How to declare a signal handler getting passed a GdkEventButton as argument

Christian Mallwitz c.mallwitz at gmail.com
Mon Apr 22 00:55:56 WST 2013


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?

Thanks
Christian


More information about the pygtk mailing list