On Tue, Sep 23, 2003 at 05:15:35PM +0000, Ian Szufnara wrote: > I was wondering if there is a way to connect a widget such as a > gtk.SpinButton() to a variable. So say i stored some value into a > variable, myVar = 10, the value shown on the Spinner would update to the > new value.
You can implement this by associating myVar with an instance and hooking the __setattr__() method to do a spinbutton value update (using set_value() or set_text(), depending on the content). I do this in the Kiwi (http://www.async.com.br/projects/kiwi/) Proxy class automatically, but it doesn't support PyGTK2 (yet). > I currently have a (rather large) array that holds the values of each one > of my spinners when they get updated, using the command: > mySpin.connect("value_changed", self.handle_change_value, cardnum, rownum, > item) > > (where cardnum, rownum, item can be thought of as a 3 dimensional array) > > I want to be able change the value of each 'item' to a value by setting the > corresponding varuable to a certain value. Which means you want the reverse of what widget.connect() does. > I know that there is something similar in Tkinter, where a widget can be > attached to a variable, is there any equivalent in (py)GTK 2.x? Really? Do you have a reference for code that does this? I'm curious to see what the semantics are. Take care, -- Christian Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331 _______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
