在python中检测哪个键被按下 [英] Detect in python which keys are pressed

查看:182
本文介绍了在python中检测哪个键被按下的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要知道现在按下哪个键。我不想捕获一些特定的键来触发一个事件或类似的事情,



我想知道现在按哪个键并显示它们的列表。



我还需要捕获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

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屋!

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