Why PyAutoGui LocateOnScreen() only Returns None

前端 未结 11 1940
悲&欢浪女
悲&欢浪女 2020-12-15 10:39

Here\'s the code that I\'m trying to run:

import pyautogui
r=pyautogui.locateOnScreen(\'C:\\Users\\David\\Desktop\\index.png\',grayscale=False)
print r
         


        
11条回答
  •  余生分开走
    2020-12-15 11:22

    I got this working by using the following:

    r = None
    while r is None:
        r = pyautogui.locateOnScreen('rbin.PNG', grayscale = True)
    print icon_to_click + ' now loaded'
    

    The key is to make grayscale = True.

提交回复
热议问题