Fixed a bug where the answer was deemed incorrect if it had uppercase letter in the .tst file
This commit is contained in:
commit
e5467ba459
3 changed files with 40 additions and 29 deletions
BIN
programfiles/vyzkousejme.exe
Normal file
BIN
programfiles/vyzkousejme.exe
Normal file
Binary file not shown.
|
@ -3,6 +3,8 @@ from tkinter import filedialog
|
|||
from tkinter import messagebox
|
||||
import random
|
||||
import time
|
||||
import multiprocessing
|
||||
import sys
|
||||
|
||||
|
||||
def swapSides(): # prohodi sloupce v souboru testu (a tim i zmeni co je otazka a co odpoved)
|
||||
|
@ -53,6 +55,7 @@ def on_closing(): #zobrazi se pri zavirani programu, pokud se uzivatel rozhodne
|
|||
|
||||
def submitAnswer(uselessArgument): # precte pole pro zadani odpovedi, zhodnoti ji, a vhodnym zpusobem zmeni score a highscore
|
||||
global score
|
||||
|
||||
for i in test[1][questionPlace]:
|
||||
if answerEntry.get().lower() == i.lower():
|
||||
score += timeMultiplier
|
||||
|
@ -63,6 +66,7 @@ def submitAnswer(uselessArgument): # precte pole pro zadani odpovedi, zhodnoti j
|
|||
if score > test[2]:
|
||||
test[2] = score
|
||||
highScore.set('High score: %s' % (test[2]))
|
||||
|
||||
answerEntry.delete(0, 'end')
|
||||
newQuestion()
|
||||
currentScore.set('Score: %s' % round(score, 2))
|
||||
|
@ -100,9 +104,11 @@ def openTest(): # ziska adresu testu a nastavi seznam test aby byl novy test, po
|
|||
gotfile = False
|
||||
filepath = None
|
||||
while not gotfile:
|
||||
filepath = filedialog.askopenfilename(title='Select test file')
|
||||
filepath = filedialog.askopenfilename(title='Select test file', initialdir="///tests")
|
||||
if getExtension(filepath) == '.tst':
|
||||
gotfile = True
|
||||
elif getExtension(filepath) == None:
|
||||
pass
|
||||
else:
|
||||
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))
|
||||
|
@ -125,14 +131,16 @@ def makeRoot(): # vytvori hlavni okno
|
|||
root.geometry('500x400')
|
||||
root.title('Test Me')
|
||||
root.configure(bg="gray")
|
||||
root.iconbitmap('programfiles/icon.ico')
|
||||
root.iconbitmap('icon.ico')
|
||||
return root
|
||||
|
||||
|
||||
multiprocessing.freeze_support()
|
||||
|
||||
root = makeRoot()
|
||||
|
||||
filepath = 'programfiles/default.tst'
|
||||
test = list(formatTest('programfiles/default.tst'))
|
||||
filepath = 'default.tst'
|
||||
test = list(formatTest('default.tst'))
|
||||
questionPlace = 0
|
||||
score = 0.0
|
||||
|
||||
|
@ -179,4 +187,7 @@ while(running):
|
|||
timeMultiplierLabel.configure(text='Your time bonus is: %s' % round(timeMultiplier, 2))
|
||||
except:
|
||||
None
|
||||
try:
|
||||
root.update()
|
||||
except:
|
||||
pass
|
BIN
vyzkousejme.exe.lnk
Normal file
BIN
vyzkousejme.exe.lnk
Normal file
Binary file not shown.
Loading…
Reference in a new issue