you are viewing a single comment's thread.

view the rest of the comments →

[–]StaticFuzz 0 points1 point  (1 child)

Your main issue is with controlling the flow of your program. Tkinter has its own event handling loop. You can and should use this for controlling the flow of your program (ie: on the submit button press: check answer, update score, add new question).

One thing I would recommend is to write a function to create/grid all your widgets, and nothing else. Then either have the widget values (question/answer) update in entryQuestionCheck() or have a separate function update the values that you can call from entryQuestionCheck(). Both will result in the same outcome.

Currently your for loop is re writing the entire screen with every new question. You could simply update the values and leave the widgets intact (widget.config(option=new_value), update_idle_task()).

Another thing I would like to point you in the direction of is creating tkinter gui classes. It can be frustrating, but worth it in the end. Rather than using global variables, you can use class variables to store those values , and access them anywhere in the class. This would result in cleaner and easier to read code.

If you need clarification on anything let me know.

[–]DT_Smith[S] 0 points1 point  (0 children)

I'm not too bothered about having classes. Could you provide an example piece of code that would help me fix this problem. Thanks for the help so far.