|
发表于 2019-6-28 16:29:11
|
显示全部楼层
from tkinter import *
class APP():
def __init__(self,master):
self.var = IntVar()
Radiobutton(master, text="One", variable=self.var, value=1,command=self.get_value).\
pack(anchor=W)
Radiobutton(master, text="Two", variable=self.var, value=2,command=self.get_value).\
pack(anchor=W)
Radiobutton(master, text="Three", variable=self.var, value=3,command=self.get_value).\
pack(anchor=W)
def get_value(self):
print(self.var.get())
root = Tk()
app = APP(root)
mainloop()
这个可以获取button的值!哈哈!小白一名参考大佬代码写一下!
|
|