单选按钮

tkinter.Radiobutton(root,text='a').pack()
tkinter.Radiobutton(root,text='b').pack()
tkinter.Radiobutton(root,text='c').pack()

默认被选中,且单个一组

(5)python tkinter-单选、多选_单选按钮

variable把Radiobutton分成了一个组.

value一组里的单个按钮
tkinter.Radiobutton(root,text='a',variable =1,value = 1).pack()
tkinter.Radiobutton(root,text='b',variable =1,value = 2).pack()
tkinter.Radiobutton(root,text='c',variable =1,value = 3).pack()

 

增加 indicatoron=0属性,改变单选按钮风格

(5)python tkinter-单选、多选_单选按钮_02