pyautogui.locateCenterOnScreen() returns None instead of coordinates

Venkatesh J picture Venkatesh J · Aug 22, 2015 · Viewed 10.2k times · Source
import pyautogui
print (pyautogui.locateCenterOnScreen("C:\Users\Venkatesh_J\PycharmProjects\mouse_event\mouse_event.png"))

Instead of returning coordinates, it returns None.

Answer

Don Kirkby picture Don Kirkby · May 5, 2016

Seems like it couldn't find anything matching your image on the screen.

locateCenterOnScreen(image, grayscale=False) - Returns (x, y) coordinates of the center of the first found instance of the image on the screen. Returns None if not found on the screen.