How can I simulate a keystroke in python? I also want to press multiple keys simultaneously.
Something like:
keystroke('CTRL+F4')
or
keystroke('Shift+A')
Consider python-uinput and evdev. Example of shift+a with the latter:
shift+a
from evdev import uinput, ecodes as e with uinput.UInput() as ui: ui.write(e.EV_KEY, e.KEY_LEFTSHIFT, 1) ui.write(e.EV_KEY, e.KEY_A, 1) ui.syn()
1.4m articles
1.4m replys
5 comments
57.0k users