help with radionbutton

John McMonagle jmcmonagle at velseis.com.au
Tue Mar 27 08:05:19 CEST 2007


Sang Park wrote:
> how do I select radionbutton by default? 
> for my school project, I need to have 10 radio buttons and have half of 
> them selected
> I have
> for i in range(10):
> x = IntVar()
> if i < 5:
> rb = Radiobutton(buttonFrame, variable=x, value=1,state=DISABLED)
> else:
> rb = Radiobutton(buttonFrame, variable=x, value=0,state=DISABLED)
> 
> I tried x.set(1) or x.set(0) before or after but the all seem to be 
> deselected when displayed on the screen
> I also tried calling rb.select/deselect() but that doesn't seem to work 
> either...
> can anyone help me?
> 
> 
Sounds like you actually want to use Checkbuttons.  Radiobuttons allow 
unique selections from a group all tied to a single variable whereas 
Checkbuttons act like an on/off toggle.

Regards,

John




More information about the Python-list mailing list