Search code examples
pythonpyautogui

pyautogui.leftclick and or rightclick doesnt work


import pyautogui, time

time.sleep(5)
pyautogui.moveTo(x=960, y=540)
pyautogui.sleep(0.5)
pyautogui.rightClick

For some reason, the rightclick doesnt work idk pls help


Solution

  • instead of moving it first and clicking you have to do

      import pyautogui, time
    
      time.sleep(5)
      pyautogui.rightClick(x=960, y=540)