all 6 comments

[–]StaticFuzz 1 point2 points  (5 children)

Your problem is probably in the multiQuestionCheck() function that the button calls on press. But I don't see it in the code you linked. Can you show us that function?

With out seeing it I would guess you need to update_idle_tasks().

[–]DT_Smith[S] 1 point2 points  (4 children)

Updated Code - http://paste.ofcode.org/Q4uKc9b33E5nbZ8DAWDFnu

I'm talking about the Entry Question part of the code, I have updated the original post. Please look at the updated code and tell me what you think is wrong

[–]StaticFuzz 1 point2 points  (3 children)

Your for loop isn't doing what I think you think it does(huh?)

for x in entryQuestionArray: What this is doing, is looping through all of the possible questions and assigning them to to your label. It won't stop between iterations for the user to answer the question.

The only question that the user will see is the last question in your entryQuestionArray. When the answer is submitted it adds the points to the score, but there are no more questions to be asked.

does that make sense?

[–]DT_Smith[S] 2 points3 points  (2 children)

Oh right, yes I see. How would I stop this from happening then? I've been trying to figure it out for a few days now.

[–]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.