我写了一些调查问卷,单击下一步或复选按钮不会破坏问题。有时它起作用,有时却不起作用。真的很奇怪这些问题将放在旧的问题之上。这就像一堆问题,真是令人讨厌。
def myLabeldestroy(self): myLabel01.destroy() def checkAnswer(self): ###Creation of random integers self.iniRand() ###Delete myLabel self.myLabeldestroy() self.mylabel(self.theories[self.qList][self.index][self.zero], 0, 1) ###Check whether answer is in used list or not if self.theories[self.qList] not in self.usedTheories: if self.gs[self.index][self.zero] not in self.used: ###Correct answer self.myEntry.get() == str(self.theories[self.qList][self.index][self.one]) self.used.append(self.gs[self.index][self.zero]) self.mylabel(self.answer[self.answerIndex], 2, 1) self.counter += self.one ###Point counter self.mylabel("Point counter " + str(self.counter), 4, 1) ###Wrong answer else: self.mylabel(self.reply[self.answerIndex], 2, 1) def nextAnswer(self): ###Creation of random integers self.iniRand() ###Delete myLabel self.myLabeldestroy() self.mylabel(self.theories[self.qList][self.index][self.zero], 0, 1) ###Check whether answer is in used list or not if self.theories[self.qList] not in self.usedTheories: if self.gs[self.index][self.zero] not in self.used: self.used.append(self.gs[self.index][self.zero]) self.counter -= self.one ###Point counter self.mylabel("Point counter " + str(self.counter), 4, 1)
答案 0 :(得分:0)
我建议您使用其他方法。如果您使用的是.pack()方法,请使用pack_forget()或grid_forget()(如果您使用的是.grid())。有关详细信息,请访问here。 / p>
答案 1 :(得分:0)
我发现了我的错误。我必须创建两个销毁方法。
def myLabeldestroyStart(self): self.myLabelstart01.destroy() def myLabeldestroyQuestions(self): self.myLabelquestion01.destroy()