Simulate Mouse Clicks on Python

前端 未结 9 1959
渐次进展
渐次进展 2020-12-13 12:52

I\'m currently in the process of making my Nintendo Wiimote (Kinda sad actually) to work with my computer as a mouse. I\'ve managed to make the nunchuk\'s stick control actu

9条回答
  •  误落风尘
    2020-12-13 13:42

    You can install the PyAutoGUI GUI automation module from PyPI (run pip install pyautogui) and then call the pyautogui.click() to click on a certain X and Y coordinates of the screen:

    >>> import pyautogui
    >>> pyautogui.click(50, 100)
    >>> pyautogui.moveTo(200, 200)
    

    PyAutoGUI works on Windows, Mac, and Linux, and on Python 2 and 3. It also can emulate the keyboard, do mouse drags, take screenshots, and do simple image recognition of the screenshots.

    Full docs are at https://pyautogui.readthedocs.org/

提交回复
热议问题