[pygtk] signal_autoconnect not working

Jeffrey Drake jeffd at techsociety.ca
Tue Sep 23 13:38:57 WST 2008


While attempting to do some basic things in pygtk for the first time, I
have ran into repeated trouble with gtk.glade.XML.signal_autoconnect.

My code is shown below. It should be noted that on_quit works (destroy
for main window), but on_update does not. I can verify that in Glade,
the "clicked" signal on the GtkButton is attached it 'on_update'. Below
you will note a commented out 'connect' function call - this works.

For somewhat obvious reasons, I would really like signal_autoconnect to
work. 

Please advise,
Jeffrey Drake.

Code:

class Demo1:
    def __init__(self):
        self.tree = gtk.glade.XML('demo1.glade')
                        
        self.on_quit = gtk.main_quit
        
        self.window = self.tree.get_widget("MainWindow")
        self.grid_width = self.tree.get_widget("grid_width")
        self.grid_height = self.tree.get_widget("grid_height")
        self.nstars = self.tree.get_widget("number_stars")        
        self.update_button = self.tree.get_widget("cmd_update")
#        self.update_button.connect("clicked", self.on_update)
        
        self.tree.signal_autoconnect(self)

                
    def on_paint(self, widget, data=None):
        pass        
        
    def on_update(self, widget, data=None):
        print "Updating starmap with width %d, height %d, and %d stars."
% (
            self.grid_width.get_property("adjustment").get_value(), 
            self.grid_height.get_property("adjustment").get_value(), 
            self.nstars.get_property("adjustment").get_value())




More information about the pygtk mailing list