so i have a maths program and i have the user entering 10 questions. once the ten questions are over it displays how many you got correct etc.
what i want to do is link the progress bar to the amount of questions answered so if user has done 5 questions progress will be half way then once theve done 10 start all over again. i currently have this definition here for submitting the answers
def submit(self):
try:
user_answer = int(self.answer_strvar.get())
except:
return
if eval(self.equation) == user_answer:
print('Correct!! The Answer Was {}'.format(user_answer))
self.correct_counter += 1
else:
print('Wrong!! Your Answer was: {} = {}, The Correct answer is {}'.format(self.equation, user_answer, eval(self.equation)))
self.submit_counter += 1
if self.submit_counter < NUM_QUESTIONS:
self.update_equation()
else:
self.show_result()
self.submit_counter = 0
self.correct_counter = 0
where as submit counter is the amount of answers submitted by user. that is the variable i want to link it to with that number being the percentage done and 10 being the maxximum.
i also have a progress bar like this on the main screen
pb = ttk.Progressbar(self, orient="horizontal", length=600, mode="determinate")
pb.pack()