Simulate Mouse Clicks on Python

前端 未结 9 1938
渐次进展
渐次进展 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:23

    PyAutoGui works superb.. Thanks to Al Sweigart...

    An example of mine...

    import pyautogui
    
    pyautogui.FAILSAFE = False
    
    for x in range(555, 899):
        pyautogui.moveTo(x, x)
    
    0 讨论(0)
  • 2020-12-13 13:25

    python-uinput is very easy to use.

    http://tjjr.fi/software/python-uinput/

    Here's an example https://github.com/tuomasjjrasanen/python-uinput/blob/master/examples/mouse.py

    0 讨论(0)
  • 2020-12-13 13:25

    Open your terminal and goto cd /usr/share/pyshared/twisted/protocols/mice
    may this __init__.py mouseman.py python script will work for you,check them out.

    0 讨论(0)
  • 2020-12-13 13:34

    The evdev package provides bindings to parts of the input handling subsystem in Linux. It also happens to include a pythonic interface to uinput.

    Example of sending a relative motion event and a left mouse click with evdev:

    from evdev import UInput, ecodes as e
    
    capabilities = {
        e.EV_REL : (e.REL_X, e.REL_Y), 
        e.EV_KEY : (e.BTN_LEFT, e.BTN_RIGHT),
    }
    
    with UInput(capabilities) as ui:
        ui.write(e.EV_REL, e.REL_X, 10)
        ui.write(e.EV_REL, e.REL_Y, 10)
        ui.write(e.EV_KEY, e.BTN_LEFT, 1)
        ui.syn()
    
    0 讨论(0)
  • 2020-12-13 13:34

    you might find this helpful:

    http://www.eventghost.org/

    Good luck!

    0 讨论(0)
  • 2020-12-13 13:37

    You can try to interface XTE program from the Python script.

    0 讨论(0)
提交回复
热议问题