Я использую python в проекте класса, и я хочу сделать несколько вариантов немецкого теста, и у меня есть почти все, что я хочу, но я не знаю, как сделать тест, чтобы люди не могли просто нажать правильный ответ снова и снова и добавить к их счету.
from tkinter import *
from tkinter import ttk
def main():
tabs.add(frame1, text="Q1")
tabs.add(frame2, text="Q2")
tabs.add(frame3, text="Q3")
Label(frame1, text="What is the capitol of Germany?").grid(row=2,column=2)
Button(frame1, text="Berlin",command=correct).grid(row=3,column=1)
Button(frame1, text="Poland",command=incorrect).grid(row=3,column=2)
Button(frame1, text="Auschwitz",command=incorrect).grid(row=3,column=3)
Label(frame2, text="What does 'Wo ist die Toilette' mean?").grid(row=2,column=2)
Button(frame2, text="What is the toilet",command=incorrect2).grid(row=3,column=1)
Button(frame2, text="Where is the toilet",command=correct2).grid(row=3,column=2)
Button(frame2, text="Woah, that's a toilet",command=incorrect2).grid(row=3,column=3)
Label(frame3, text="What does 'Wie ist dein Name' mean?").grid(row=2,column=2)
Button(frame3, text="That is my name",command=incorrect3).grid(row=3,column=1)
Button(frame3, text="Why is that your name",command=incorrect3).grid(row=3,column=2)
Button(frame3, text="What is your name",command=correct3).grid(row=3,column=3)
tabs.pack()
Label(root, text="Total:").pack()
Label(root, textvariable=total).pack()
def correct():
Label(frame1,text="Correct! Good job").grid(row=1,column=2)
counter()
def incorrect():
Label(frame1,text="Incorrect, try again").grid(row=1,column=2)
def correct2():
Label(frame2,text="Correct! Good job").grid(row=1,column=2)
counter()
def incorrect2():
Label(frame2,text="Incorrect, try again").grid(row=1,column=2)
def correct3():
Label(frame3,text="Correct! Good job").grid(row=1,column=2)
counter()
def incorrect3():
Label(frame3,text="Incorrect, try again").grid(row=1,column=2)
def counter():
total.set(total.get() + 1)
root = Tk()
root.title("German Quiz!")
total = IntVar()
tabs=ttk.Notebook(root)
frame1 = ttk.Frame(tabs)
frame2 = ttk.Frame(tabs)
frame3 = ttk.Frame(tabs)
main()
root.mainloop()