Hello.

It is possible you do not added the correct function in your .glade.

You must go to "properties" and select "signals". At the correct signal
you have to set the name. As I see in your code, you'd have to set
"clicked" signal of button to "on_update".

If your widget as no function asigned to a signal, signal_connect is
not going to work.

See you.

El Tue, 23 Sep 2008 01:38:57 -0400
Jeffrey Drake <[EMAIL PROTECTED]> escribió:

> 
> 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())
> 
> 
> _______________________________________________
> pygtk mailing list   [email protected]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


-- 
In a world without walls and fences, who needs Windows and Gates?
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to