from Tkinter import *
root = Tk()
v = IntVar()
v.set(0)
def click():
print "1"
class MyRadio(Radiobutton):
def __init__(self,root,variable,value):
self.variable = variable
self.value = value
Radiobutton.__init__(self,root,variable=variable,value=value,command=self.click)
def click(self):
print self.variable,'====',self.value
for i in range(3):
MyRadio(root,
variable = v,
value = i).pack()
root.mainloop()
Tkinter 继承
最新推荐文章于 2023-08-16 07:45:00 发布