Tkinter Option (Radio) Buttons

dsavitsk dsavitsk at e-coli.net
Mon Jul 10 14:00:07 EDT 2000


If i have 3 option buttons created like in Interface() below I am able to
use Value() to determine which button is selected,  Is there a bit of code
that i could add to Value() to disable certain buttons (i don't need the
if...elif's, just how to disable an option of my choosing.) or a better way
to do this.


>>> def Value():
...    global CnType
...    print CnType.get()

>>> def Interface():
...     CnType = IntVar()
...     CnType.set(0)
...     fm = Frame()
...     optTp = Radiobutton(fm5, text='Button 0', variable=CnType, value=0)
...     optTp.grid(row=0, column=0, sticky=W)
...     optTp = Radiobutton(fm5, text='Button 1', variable=CnType, value=1)
...     optTp.grid(row=0, column=1, sticky=W)
...     optTp = Radiobutton(fm5, text='Button 2', variable=CnType, value=2)
...     optTp.grid(row=0, column=2, sticky=W)
...     fm5.pack(side=TOP)


thanks
doug





More information about the Python-list mailing list