from tkinter import *
from tkinter import messagebox
class RadioButton(Frame):
def __init__(self, master=None):
super().__init__(master)
self.master = master
self.pack()
self.createRadioButto()
def createRadioButto(self):
self.v1 = StringVar();
self.v1.set("F")
self.radiob01 = RadioButton(self, text="Man", value="T", variable=self.v1)
self.radiob01.pack(side="left")
self.radiob02 = RadioButton(self, text="Woman", value="F", variable=self.v1)
self.radiob02.pack(side="left")
if __name__ == '__main__':
root = Tk()
root.title("RadioButton")
root.geometry("400x500+300+500")
a = RadioButton(master=root)
root.mainloop()
一直报错,得到text
D:\ruanjian\Anconda_install\envs\test03\python.exe D:/STUDYEVERY/Python/exerise/GUI/GUI006.py
Traceback (most recent call last):
File "D:/STUDYEVERY/Python/exerise/GUI/GUI006.py", line 29, in <module>
a = RadioButton(master=root)
File "D:/STUDYEVERY/Python/exerise/GUI/GUI006.py", line 13, in __init__
self.createRadioButto()
File "D:/STUDYEVERY/Python/exerise/GUI/GUI006.py", line 19, in createRadioButto
self.radiob01 = RadioButton(self, text="Man", value="T", variable=self.v1)
TypeError: __init__() got an unexpected keyword argument 'text'