在python中检测哪个键被按下 [英] Detect in python which keys are pressed
问题描述
我需要知道现在按下哪个键。我不想捕获一些特定的键来触发一个事件或类似的事情,
我想知道现在按哪个键并显示它们的列表。
我还需要捕获F1 ... F12,shift,alt,home,windows等特殊键。基本上键盘上的所有键。
如何在python中执行此操作?如何捕获键盘事件?
相关
编辑
只是你知道我不是想成为一个键盘记录器。我试图做一个诊断工具(我的笔记本电脑上分水,有时候键盘已经开始疯了!)
PyKeylogger ,在相关问题可能会做这个工作。
I need to know which key is being pressed right now. I'm not looking to capture some specific keys to trigger an event or anything like that,
I want to know which keys are pressed now and display a list of them.
I also need to capture special keys like F1 ... F12, shift, alt, home, windows, etc. Basically all keys on the keyboard.
How do I do this in python? How do I capture keyboard events?
Related
- Cross platform keylogger
- Is there a cross-platform python low-level API to capture or generate keyboard events?
EDIT
Just so you know I'm not trying to make a keylogger. I'm trying to make a diagnoses tool (I split water on my laptop and the keyboard is starting to get crazy sometime!!)
PyKeylogger mentioned in the related question might do the job.
这篇关于在python中检测哪个键被按下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!