关键字arg python类之后的非关键字arg

时间:2015-02-22 20:55:55

标签: python class tkinter radio-button

我无法理解该代码发生了什么......请帮助Python新手!在python中关键字arg之后说非关键字arg是什么意思?我该怎么做才能在下面运行我的代码?在使用初始化该类所需的参数调用类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()

1 个答案:

答案 0 :(得分:4)

这是你的问题:

choice=CreatingWindowForEachLesson(root,tomeas="ΣΥΣΤΗΜΑΤΩΝ ΑΥΤΟΜΑΤΟΥ ΕΛΕΓΧΟΥ",saeA7,saeB7,saeG7)

当你在参数中包含赋值时,你真正在做的是创建一个字典。您需要在没有赋值的情况下将其放在参数之后。确保您的其他方法遵循相同的规则:

choice=CreatingWindowForEachLesson(root,saeA7,saeB7,saeG7, tomeas="ΣΥΣΤΗΜΑΤΩΝ ΑΥΤΟΜΑΤΟΥ ΕΛΕΓΧΟΥ")
相关问题