问题
I need to generate keystrokes in Linux (Raspbian) from Python3. Something like uinput
but for Python3. I'd prefer not to use subprocess
for this.
Easier to install (apt-get) the better as it will be used in a guide to show others.
Any ideas? Thomas
回答1:
Found PyUserInput that works.
https://github.com/SavinaRoja/PyUserInput/wiki/Installation https://github.com/SavinaRoja/PyUserInput
sudo apt-get install python3-pip
sudo pip-3.2 install python3-xlib
sudo pip-3.2 install PyUserInput
And the Python:
from pykeyboard import PyKeyboard
keyboard = PyKeyboard()
keyboard.tap_key("a")
来源:https://stackoverflow.com/questions/32536270/generate-keystrokes-in-linux-from-python3