我创建了一个数学游戏,当我加载第一个问题时它很好,如果我得到正确的答案,分数会增加 100,但是当它加载下一个问题时,它会直接将它加载到旧问题的顶部并且分数没有更长的增加。
我的计数器也无法结束游戏。
任何人都可以帮忙吗?
def do_question(self):
## def create_widgets(self):
#counter here if over 5 then die
counter = 0
counter += 1
#counter + 1
if counter > 5:
import ITRIED
SQL = 'SELECT * FROM tblQuestion'
cursor = Databaseconnector.SELECT(SQL)
rows = cursor.fetchall()
random_row = random.choice(rows)
print random_row.QuestionID, random_row.Question, random_row.Hint, random_row.A1, random_row.A2, random_row.A3, random_row.A4, random_row.CorrectAnswer
self.a1button = Tkinter.Button(self, background="blue",foreground="white", text = (random_row.A1), command = self.QUESTION1)
self.a1button.grid(row = 9, column = 1, sticky = 'W')
问题检查器:
def QUESTION1(self):
score = int(self.label7['text'])
if self.a1button['text'] == self.label6['text']:
tkMessageBox.showinfo("CORRECT", "WELL DONE")
score = +100
self.do_question()
else:
tkMessageBox.showinfo("INCORRECT", "YOU GOT IT WRONG :/")
label7 = +100
self.do_question()
self.label7.config(text=str(score))