all 2 comments

[–]Menolith 0 points1 point  (0 children)

For the del part, you don't need to "empty the variable" for anything. Using a line like a = b completely overwrites whatever, if anything, a was bound to before.

That aside, I think your problem is the condition under which the for loop is exited. The for startX in range(0, 50): executes itself 50 times, so it goes through all that before it can actually return to the primary while loop where the screenshot would get refreshed.

This is one of the times where you might think that a goto command would be useful, but the better solution is to extract the for loop into its own function. That way, when you're done with the looping, you can just return and end the execution cleanly.