Radiobutton HELP!!
Rbtns
rbtns082484 at hotmail.com
Thu Aug 23 10:29:46 EDT 2001
Hi, I'm trying to use Radiobuttons with Tkinter. I've used them before,
but never two lists of them at one time. The problem I am having is
that everytime I make a selection in one radiobutton list, the program
automatically makes that same selection for the other list. I have
included sample code to illustrate:
from Tkinter import *
root = Tk()
root.title('Radio Button Test')
sel1 = -1
sel2 = -1
menubar = Menu(root)
sel1menu = Menu(menubar, tearoff=0)
sel2menu = Menu(menubar, tearoff=0)
for a in range(3):
sel1menu.add_radiobutton(label='Select'+str(a),variable=sel1,value=a)
for a in range(5):
sel2menu.add_radiobutton(label='Select'+str(a),variable=sel2,value=a)
menubar.add_cascade(label='Select1',menu=sel1menu)
menubar.add_cascade(label='Select2',menu=sel2menu)
root.config(menu=menubar)
root.mainloop()
If anyone knows how to do this, please don't hesistate to respond. Thank
you very much.
More information about the Python-list
mailing list