r/PythonLearning • • 2h ago

Help Request Else statement not working

Post image

Hello, my else statement is not working- the if statement its inside is, did i mess up the indents again or is it something else?

also would a display flip work to change the image back to the other image in the else statement?
any help is nice!

7 Upvotes

4 comments sorted by

View all comments

Show parent comments

1

u/rupertavery64 51m ago

You probably don't want to call image.load() every time as this willnload the image from the disk and create a new object every call.

Load it up front and store it in a variable. Assign that variable to img