关键字 arg 之后的非关键字 arg python 类
non keyword arg after keyword arg python classes
我无法理解该代码发生了什么...请帮助 Python 中的新人!在 python 中关键字 arg 之后说非关键字 arg 是什么意思?我可以如何处理下面的 运行 我的代码?使用 class 初始化所需的参数调用 class CreatingWindowForEachLesson 时会调用错误。帮助!
class WindowSector():
global root
def __init__(self):
self.master=master
self.startwindow()
def startwindow(self):
self.l=Label(self.master,text="Επιλογή Τομέα Σπουδών")
self.l.pack()
self.v=IntVar()
self.v.set(1)
self.r1=Radiobutton(self.master,text="ΤΟΜΕΑΣ ΣΥΣΤΗΜΑΤΩΝ ΑΥΤΟΜΑΤΟΥ ΕΛΕΓΧΟΥ",variable=self.v, value=1)
self.r1.pack(anchor=W)
self.r1.invoke()
self.r2=Radiobutton(self.master,text="ΤΟΜΕΑΣ ΗΛΕΚΤΡΟΝΙΚΗΣ ΚΑΙ ΥΠΟΛΟΓΙΣΤΩΝ",variable=self.v, value=2)
self.r2.pack(anchor=W)
self.r2.invoke()
self.r3=Radiobutton(self.master,text="ΤΟΜΕΑΣ ΤΗΛΕΠΙΚΟΙΝΩΝΙΩΝ ΚΑΙ ΠΛΗΡΟΦΟΡΙΑΣ",variable=self.v, value=3)
self.r3.pack(anchor=W)
self.r3.invoke()
self.r4=Radiobutton(self.master,text="ΤΟΜΕΑΣ ΣΥΣΤΗΜΑΤΩΝ ΗΛΕΚΤΡΙΚΗΣ ΕΝΕΡΓΕΙΑΣ",variable=self.v, value=4)
self.r4.pack(anchor=W)
self.r4.invoke()
self.b=Button(self.master,text="Συνέχεια")
self.b.pack(anchor=E)
def ButtonClick(self):
global choice,root,saeA7,saeB7,saeG7,yA7,yB7,yG7,tpA7,tpB7,tpG7,eA7,eB7,eG7
if (self.v.get())==1:
choice=CreatingWindowForEachLesson(root,tomeas="ΣΥΣΤΗΜΑΤΩΝ ΑΥΤΟΜΑΤΟΥ ΕΛΕΓΧΟΥ",saeA7,saeB7,saeG7)
self.master.quit()
elif (self.v.get())==2:
choice=CreatingWindowForEachLesson(root,tomeas="ΗΛΕΚΤΡΟΝΙΚΗΣ ΚΑΙ ΥΠΟΛΟΓΙΣΤΩΝ")#,yA7,yB7,yG7)
self.master.quit()
elif (self.v.get())==3:
choice=CreatingWindowForEachLesson(root,tomeas="ΤΗΛΕΠΙΚΟΙΝΩΝΙΩΝ ΚΑΙ ΠΛΗΡΟΦΟΡΙΑΣ")#,tpA7,tpB7,tpG7)
self.master.quit()
elif (self.v.get())==4:
choice=CreatingWindowForEachLesson(root,tomeas="ΣΥΣΤΗΜΑΤΩΝ ΗΛΕΚΤΡΙΚΗΣ ΕΝΕΡΓΕΙΑΣ")#,eA7,eB7,eG7)
self.master.quit()
这是您的问题:
choice=CreatingWindowForEachLesson(root,tomeas="ΣΥΣΤΗΜΑΤΩΝ ΑΥΤΟΜΑΤΟΥ ΕΛΕΓΧΟΥ",saeA7,saeB7,saeG7)
当您在参数中包含赋值时,您真正在做的是创建字典。您需要在没有分配的情况下将其放在参数之后。确保您的其他方法遵循相同的规则:
choice=CreatingWindowForEachLesson(root,saeA7,saeB7,saeG7, tomeas="ΣΥΣΤΗΜΑΤΩΝ ΑΥΤΟΜΑΤΟΥ ΕΛΕΓΧΟΥ")
我无法理解该代码发生了什么...请帮助 Python 中的新人!在 python 中关键字 arg 之后说非关键字 arg 是什么意思?我可以如何处理下面的 运行 我的代码?使用 class 初始化所需的参数调用 class CreatingWindowForEachLesson 时会调用错误。帮助!
class WindowSector():
global root
def __init__(self):
self.master=master
self.startwindow()
def startwindow(self):
self.l=Label(self.master,text="Επιλογή Τομέα Σπουδών")
self.l.pack()
self.v=IntVar()
self.v.set(1)
self.r1=Radiobutton(self.master,text="ΤΟΜΕΑΣ ΣΥΣΤΗΜΑΤΩΝ ΑΥΤΟΜΑΤΟΥ ΕΛΕΓΧΟΥ",variable=self.v, value=1)
self.r1.pack(anchor=W)
self.r1.invoke()
self.r2=Radiobutton(self.master,text="ΤΟΜΕΑΣ ΗΛΕΚΤΡΟΝΙΚΗΣ ΚΑΙ ΥΠΟΛΟΓΙΣΤΩΝ",variable=self.v, value=2)
self.r2.pack(anchor=W)
self.r2.invoke()
self.r3=Radiobutton(self.master,text="ΤΟΜΕΑΣ ΤΗΛΕΠΙΚΟΙΝΩΝΙΩΝ ΚΑΙ ΠΛΗΡΟΦΟΡΙΑΣ",variable=self.v, value=3)
self.r3.pack(anchor=W)
self.r3.invoke()
self.r4=Radiobutton(self.master,text="ΤΟΜΕΑΣ ΣΥΣΤΗΜΑΤΩΝ ΗΛΕΚΤΡΙΚΗΣ ΕΝΕΡΓΕΙΑΣ",variable=self.v, value=4)
self.r4.pack(anchor=W)
self.r4.invoke()
self.b=Button(self.master,text="Συνέχεια")
self.b.pack(anchor=E)
def ButtonClick(self):
global choice,root,saeA7,saeB7,saeG7,yA7,yB7,yG7,tpA7,tpB7,tpG7,eA7,eB7,eG7
if (self.v.get())==1:
choice=CreatingWindowForEachLesson(root,tomeas="ΣΥΣΤΗΜΑΤΩΝ ΑΥΤΟΜΑΤΟΥ ΕΛΕΓΧΟΥ",saeA7,saeB7,saeG7)
self.master.quit()
elif (self.v.get())==2:
choice=CreatingWindowForEachLesson(root,tomeas="ΗΛΕΚΤΡΟΝΙΚΗΣ ΚΑΙ ΥΠΟΛΟΓΙΣΤΩΝ")#,yA7,yB7,yG7)
self.master.quit()
elif (self.v.get())==3:
choice=CreatingWindowForEachLesson(root,tomeas="ΤΗΛΕΠΙΚΟΙΝΩΝΙΩΝ ΚΑΙ ΠΛΗΡΟΦΟΡΙΑΣ")#,tpA7,tpB7,tpG7)
self.master.quit()
elif (self.v.get())==4:
choice=CreatingWindowForEachLesson(root,tomeas="ΣΥΣΤΗΜΑΤΩΝ ΗΛΕΚΤΡΙΚΗΣ ΕΝΕΡΓΕΙΑΣ")#,eA7,eB7,eG7)
self.master.quit()
这是您的问题:
choice=CreatingWindowForEachLesson(root,tomeas="ΣΥΣΤΗΜΑΤΩΝ ΑΥΤΟΜΑΤΟΥ ΕΛΕΓΧΟΥ",saeA7,saeB7,saeG7)
当您在参数中包含赋值时,您真正在做的是创建字典。您需要在没有分配的情况下将其放在参数之后。确保您的其他方法遵循相同的规则:
choice=CreatingWindowForEachLesson(root,saeA7,saeB7,saeG7, tomeas="ΣΥΣΤΗΜΑΤΩΝ ΑΥΤΟΜΑΤΟΥ ΕΛΕΓΧΟΥ")