这就是python似乎对我不太满意的代码:
def checkAnswer(self, clickedButton):
self.valueOne = self.itemOne[self.component]
self.valueTwo = self.itemTwo[self.component]
if clickedButton == 'left':
if self.valueOne >= self.valueTwo:
tkinter.messagebox.showinfo('Smart Cookie!', 'That\'s correct!')
else:
tkinter.messagebox.showerror('Oh No!', 'That\'s incorrect!')
elif clickedButton == 'middle':
if self.valueOne - (self.valueOne * 0.1) <= self.valueTwo <= self.valueOne + (self.valueOne * 0.1) and self.valueTwo - (itemTwoComp * 0.1) <= self.valueTwo <= self.valueTwo + (self.valueTwo * 0.1):
tkinter.messagebox.showinfo('Smart Cookie!', 'That\'s correct!')
else:
tkinter.messagebox.showerror('Oh No!', 'That\'s incorrect!')
elif clickedButton == 'right':
if self.valueTwo >= self.valueOne:
tkinter.messagebox.showinfo('Smart Cookie!', 'That\'s correct!')
else:
tkinter.messagebox.showerror('Oh No!', 'That\'s incorrect!')
showQuestion()
tkinter.mainloop()
showQuestion()
gui = ProgramGUI()
这是我收到的错误:
^{2}$我不知道为什么我会收到这个错误,如果有人能找出问题,我将非常感激。在
showQuestion()
正在试图修改一个小部件,但是它是在根窗口被破坏之后被调用的(例如:在mainloop()
返回之后,只有在根窗口被破坏时才会发生)。当根窗口被销毁时,所有其他小部件也将被销毁。在相关问题 更多 >
编程相关推荐