从 Python3 在 Linux 中生成击键 [英] Generate keystrokes in Linux from Python3

查看:35
本文介绍了从 Python3 在 Linux 中生成击键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在 Linux (Raspbian) 中从 Python3 生成击键.类似于 uinput 但对于 Python3.我不想为此使用 subprocess.

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.

安装 (apt-get) 越简单越好,因为它将在指南中用于向他人展示.

Easier to install (apt-get) the better as it will be used in a guide to show others.

有什么想法吗?托马斯

推荐答案

找到有效的 PyUserInput.

Found PyUserInput that works.

https://github.com/SavinaRoja/PyUserInput/wiki/Installationhttps://github.com/SavinaRoja/PyUserInput

sudo apt-get install python3-pip
sudo pip-3.2 install python3-xlib
sudo pip-3.2 install PyUserInput

还有 Python:

from pykeyboard import PyKeyboard
keyboard = PyKeyboard()
keyboard.tap_key("a")

这篇关于从 Python3 在 Linux 中生成击键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆