For pygtk-1.99.x, the above style of updating the adjustment will work (assigning to the attribute). I hadn't implemented that in the 0.6.x series which is why it isn't working. However, the following method will work:Hi all -- I'm trying to create a SpinButton whose maximum value can be changed later. (Actually, the value of one SpinButton becomes the maximum of another, but that's not really relevant.) From reading the GTK+ tutorial, it looks as though this:
""" from gtk import *
w = GtkWindow(WINDOW_TOPLEVEL) adj = GtkAdjustment(1, 1, 99, 1, 1, 1) sb = GtkSpinButton(adj, 1, 0) sb.set_wrap(True) w.add(sb)
adj2 = sb.get_adjustment() adj2.upper = 5 adj2.changed() print "adj2.upper = %r" % adj2.upper print "sb.get_adjustment().upper = %r" % sb.get_adjustment().upper
w.signal_connect("destroy", mainquit) w.show_all() mainloop() """
should work, ie. the SpinButton should have a max of 5 when it's actually rendered. But it doesn't; the damn thing always has a max of 99, and I cannot figure out any sequence of adj2.changed(), sb.set_adjustment(), sb.update(), etc. that make it work as expected.
adjustment.set_all(value, lower, upper, step_increment, page_increment, page_size)
This is a pygtk specific API that will set all the attributes and call changed() for you.
Of course, if you are writing new code, I strongly recommend using the newer versions of pygtk. GTK 1.2 is obsolete (there have already been two more stable series released since GTK 1.2: 2.0.x and 2.2.x).
James.
-- Email: [EMAIL PROTECTED] WWW: http://www.daa.com.au/~james/
_______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/