I'm trying to build a basic macro to tell if my lifebar is low but I have a bug in my program where even when lifebar.png isn't on the screen it will still print "I can see it." Can anyone explain why this is happening? Also can someone show me an example where pyautogui locates an image with x confidence and then clicks it?
Thanks.
lasthit = pyautogui.locateAllOnScreen('lifebar.png', confidence=(1))
def new_method(lasthit):
while True:
if lasthit is not None:
print("I can see it.")
time.sleep(2)
else:
print("image not found")
time.sleep(0.5)
new_method(lasthit)
question from:
https://stackoverflow.com/questions/65622888/image-found-even-if-not-on-screen 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…