[pygtk] Passing user data to callbacks with libglade

Mitko Haralanov mitko at qlogic.com
Fri Apr 11 01:38:50 WST 2008

On Thu, 10 Apr 2008 08:30:40 -0300
"Airton Arantes" <airton.arantes at gmail.com> wrote:

> Second the docs, there isn't as to pass an user data using
> signal_autoconnect method, see below:

Thank you for the reply (I somehow missed your previous one requesting

Here is a simple example that can illustrate what I am talking about:
with the PyGTK/GObject API once can do

window = gtk.Window (...)
button = gtk.Button ("test")
window.connect ("delete-event", handler, button)

the result of which is that the button widget will be passed to the
'handler' callback.

You see to be confirming my understanding that one can not
pass user data to the signal callback using signal_autoconnect. I was
also interested if there is any other way that it can be done but by
looking at the contect of the gtk.glade module it doesn't seem to be
the case.

If it is truly not possible to pass user data to signal callbacks with
Python's bindings for libglade, it seems to me that this is a pretty
big shortcoming of the module. I am not sure whether this can be done
with the C API but as far as the Python's API is concerned it seem to
limit it's usability somewhat.

I guess I could use GObject.connect instead of signal_autoconnect for
the callbacks that need data passed to them.
Mitko Haralanov
The use of anthropomorphic terminology when dealing with computing
systems is a symptom of professional immaturity.
		-- Edsger Dijkstra

More information about the pygtk mailing list