Python GUI编程(Tkinter)9、Radiobutton单选框控件

import tkinter

win = tkinter.Tk()
win.title("sunck")
win.geometry("400x400+200+20")

def updata():
print(r.get())

#一组单选框要绑定同一个变量
r = tkinter.IntVar()
radio1 = tkinter.Radiobutton(win, text="one", value=44, variable=r, command=updata)
radio1.pack()
radio2 = tkinter.Radiobutton(win, text="two", value=55, variable=r, command=updata)
radio2.pack()
radio3 = tkinter.Radiobutton(win, text="tre", value=66, variable=r, command=updata)
radio3.pack()


win.mainloop()
posted @ 2020-05-19 15:59  i勤能补拙  阅读(856)  评论(0编辑  收藏  举报