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

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

问题描述

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

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.

我还需要捕获特殊键,例如 F1 ... F12、shift、alt、home、windows 等.基本上是键盘上的所有键.

I also need to capture special keys like F1 ... F12, shift, alt, home, windows, etc. Basically all keys on the keyboard.

我如何在 python 中做到这一点?如何捕获键盘事件?

How do I do this in python? How do I capture keyboard events?

编辑

只是为了让您知道我不是要制作键盘记录器.我正在尝试制作一个诊断工具(我在笔记本电脑上分水,键盘有时开始变得疯狂!!)

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 相关问题中提到的可能会起作用.

PyKeylogger mentioned in the related question might do the job.

这篇关于在python中检测按下了哪些键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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