mercredi 1 septembre 2021

In if statement one line works others don't [duplicate]

a = 0
b = 0

def check():
    if (pya.locateOnScreen("image.PNG") != None):
        print("Found")
        a = 1
    else:
        print("Not found")
        b = 1

check()
print(a,b)

Output is:

Found
0 0

Even though it finds the image, it doesn't change the value of a.

I think the output should be:

Found
1 0

What I am doing wrong?

Aucun commentaire:

Enregistrer un commentaire