Why PyAutoGui LocateOnScreen() only Returns None

前端 未结 11 1927
悲&欢浪女
悲&欢浪女 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:15

    I had the similar problem.

    My fault was I had saved the compare picture as jpg first and then as png in MS paint.

    Be sure to save the compare picture as png format. After this the Locate function worked for me.

提交回复
热议问题