Jan-04-2023, 12:56 PM
if pyautogui.locateCenterOnScreen("loot_icon.png", confidence = 0.9): ...
pyautogui.locateCenterOnScreen
could return None
or a tuple
with two int
.The if statement asks the object for its boolean.
bool(None)
evaluates to False
.An empty
list
, tuple
, dict
, set
, str
, bytes
, etc. evaluates to False
. If they contain elements, then the bool()
call returns True
.The result that you want is a non-empty Tuple, so the approach not to check for
None
, instead check for truthiness, is better.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!