I m running linux (Pop OS 22.04) and I m trying to make a loop using pyautgui.locateOnScreen method, here s the code:
def __clicks_print(area, *print_names, nclicks=1):
loc = None
while not loc:
for print_name in print_names:
loc = pyautogui.locateOnScreen(print_name, region=area)
print(loc)
if loc:
break
pyautogui.moveTo(loc)
pyautogui.click(clicks=nclicks)
当我试图行使这一职能时,方案以下列错误结束:
raise ImageNotFoundException # Raise PyAutoGUI s ImageNotFoundException.
奇怪的部分是,我使用Windows的这种准确的排位,而只是工作,方案一直寻找一个休息室,直到找到一个。
I tried to copy the exact same function I have on a Windows machine and, it doesn t work, the program keeps stopping when it fails to locate the pixels. I want the program to keep looking until it finds the pixels on the screen. This way I can give the function multiple prints to locate.