On Thu, 2003-03-20 at 15:59, Greg Ward wrote: > 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. > > Am I missing some obvious wrinkly of GtkSpinButton and GtkAdjustment?
Wrinkle yes, obvious no. Try using adj2.set_all(adj2.value, adj2.lower, adj2.upper, adj2.step_increment, adj2.page_increment, adj2.page_size) instead of adj2.changed() > > (Oh yeah, I'm using GTK+ 1.2 and pygtk 0.6.11, mainly because I failed > to notice the 'python2.2-gtk2' package in Debian unstable. I'll go see > how things work if I upgrade now.) > > Thanks -- > > Greg -- Steve McClure <[EMAIL PROTECTED]> Racemi, Inc.
signature.asc
Description: This is a digitally signed message part
_______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/