I try to make a little gui with tkinter to improuve mental calculation. In my program, tkinter ask 10 question and the program should wait the good or bad answer before show the next question but I don't now how to wait properly
here is my code:
class PageAdd1(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self,parent)
self.controller = controller
self.id = controller.id
lblTitle = tk.Label(self, text="Mode Addition Facile") # titre de la fenêtre
lblTitle.pack()
btnBack = tk.Button(self, text="Revenir à la sélection de la difficulté",
command=lambda: controller.up_frame("PageAdd"))
btnBack.pack()
global score
global flag
global iteration
score=0
flag=False
iteration=0
def getEntry():
global score
global flag
res=int(entryRes.get())
if res == c:
score= score +1
flag=True
print(score)
btnValid = tk.Button(self, text="Valider", command=getEntry)
btnValid.pack()
lblQuestion = tk.Label(self, text="initiation")
lblQuestion.pack()
for i in range(9):
flag=False
a, b, c = addition(1)
lstQuestion = ["Quelle est le résultat de l'oppération ", str(a), " + ", str(b), "?"]
question = "".join(lstQuestion)
lblQuestion = tk.Label(self, text=question)
lblQuestion.pack()
res=tk.IntVar()
entryRes= tk.Entry(self, textvariable= res)
entryRes.pack()
print(i)
I try to put a flag with a while the flag is not true, and turn the flag true when I have the good answer but it doesn't work. I don't now how to do it... Thank you in advance