PyGTK, libglade, and signal_autoconnect

rocco.rossi at gmail.com rocco.rossi at gmail.com
Fri Jan 4 11:01:51 EST 2008


I was having a real hard time trying to accomplish something. I
couldn't find a way to automatically connect the "close" button
(clicked signal) of a GUI app I was working on, to the gtk.main_quit()
function. I had entered this handler directly with the GLADE-3
designer (I DON'T WANT TO USE A DICTIONARY, because I think that,
using GLADE, I should be able to shortcut that procedure) but in my
class the

self.wtree.signal_autoconnect(self)

wasn't working. Of course, I thought, it's looking for gtk.main_quit()
which is obviously somewhere else. So, the only solution I could think
of was to add:

self.wtree.signal_autoconnect(gtk)  --- having already imported gtk,
naturally!

This automagically worked.

What I would like to know is if this is legitimate, and the right way
to go. It is basically a solution I cooked up instinctively, which
happened to work, but perhaps I am unaware of some other more
"orthodox" way of doing it.

Thank you.

Rock



More information about the Python-list mailing list