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()
No comments:
Post a Comment