pythonubuntupyautogui

Pyautogui's click function is not working


I am using python3.12 in Ubuntu Linux OS When I do:

import pyautogui as p
p.click(x, y)

It doesn't click at all, the other functions like pyautogui.scroll, .position and all work properly, but not click.


Solution

  • Try running your script with sudo:

    sudo python3 your_script.py
    

    On Linux, pyautogui.click() sometimes requires elevated privileges to simulate mouse clicks, especially on newer Ubuntu versions.