[pygtk] Fwd: Spinbutton Set_range()

Steve McClure smcclure at racemi.com
Fri Mar 27 02:05:35 WST 2009


On Mar 26, 2009, at 12:26 PM, Peyman wrote:

> Basically What I was asking is whether the set_range(lower,upper)  
> method activates any other callbacks (like output(), changed()...)

Yes it does, just like if the user directly changed it.  You have to  
either have the two spinbuttons knowledgeable about the context of the  
change or keep the signal from being emitted when modifying the second  
spinbutton.

>
> Cheers
>
>
> Peyman Askari
>
> Begin forwarded message:
>
>> From: Peyman <paskari007 at yahoo.ca>
>> Date: 26 March 2009 16:04:12 GMT
>> To: pygtk at daa.com.au
>> Subject: Spinbutton Set_range()
>>
>> 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
>
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/

--
Steve McClure
smcclure at racemi.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20090326/7a8777ac/attachment-0001.htm 


More information about the pygtk mailing list