import pyautogui as pg clk= pg.locateOnScreen('click.png', confidence=0.9) pg.click(x=clk.left+int(clk.width/2), y=clk.top+int(clk.height/2))