[pygtk] Spinbutton Set_range()

Peyman paskari007 at yahoo.ca
Fri Mar 27 01:04:12 WST 2009


I have two spinbuttons, lets call them SpinButtonA and SpinButtonB,  
whereby SpinButtonA.get_value() <= SpinButtonB.get_value()-2. I deal  
with this by constantly updating the range of the two. I did this in  
glade, so the paramaters are widget (the calling widget), whatever  
data is passed, and wtree, which is used to retrieve the widgets.

on _ SpinButtonA_output(widget,data,wtree):
	...
	...
	...
	SpinButtonB=wtree.get_widget('SpinButtonB')

	min=widget.get_value()+2			
	max= SpinButtonB.get_range()[1]

	SpinButtonB.set_range(min,max)

on _ SpinButtonB_output(widget,data,wtree):
	...
	...
	...
	SpinButtonA=wtree.get_widget('SpinButtonA')
				
	min= SpinButtonA.get_range()[0]
	max=widget.get_value()-2

	SpinButtonA.set_range(min,max)

But some funky things start happening, and the value of the two  
spinbuttons get updated too. Does anyone know what I am doing wrong?

Cheers


Peyman Askari


More information about the pygtk mailing list