fixed a bug where the score didnt reset after swapping sides, expanded example angtest a little bit

This commit is contained in:
Zdenek Borovec 2019-09-03 12:49:38 +02:00
parent 1b7ca5f789
commit 05117ca03b
2 changed files with 7 additions and 2 deletions

View file

@ -11,3 +11,5 @@ tooth brush/kartáček na zuby,kartáček,zubní kartáček
badge/odznak
razor/žiletka,břitva
book/kniha,knížka
vitamins/vitamíny
instrument/nástroj

View file

@ -6,11 +6,14 @@ import random
def swapSides():
global test
global score
temp = test[0]
test[0] = test[1]
test[1] = temp
score = 0
currentScore.set('Score: %s' % score)
newQuestion()
@ -57,6 +60,8 @@ def submitAnswer(uselessArgument):
highScore.set('High score: %d' % (test[2]))
answerEntry.delete(0, 'end')
newQuestion()
currentScore.set('Score: %s' % score)
highScore.set('High score: %d' % test[2])
def formatTest(filepath):
@ -97,8 +102,6 @@ def openTest():
messagebox.showinfo("ERROR: unrecognized file", "We are sorry but files with the '%s' appendix are not supported, we support only '.tst' files." % (getExtension(filepath)))
test = list(formatTest(filepath))
newQuestion()
currentScore.set('Score: %s' % score)
highScore.set('High score: %d' % test[2])
def makeMenu(root):