我写了一些调查问卷,单击下一步或复选按钮不会破坏问题。有时它起作用,有时却不起作用。真的很奇怪这些问题将放在旧的问题之上。这就像一堆问题,真是令人讨厌。
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)
您可能需要在破坏按钮后调用frame.refresh()
。
[我可以建议您使用其他方法。如果您使用的是.pack()方法,请使用pack_forget()或grid_forget()(如果您使用的是.grid()。请从here中了解更多信息。