如何停止特定键在Python中的工作 [英] How to stop a specific key from working in Python
本文介绍了如何停止特定键在Python中的工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的笔记本电脑键盘有一个错误,有时会随机按数字5,所以我尝试了很多事情,但它们没有起作用,我尝试编写可以阻止它的代码,但由于我是初学者,所以无法这样做.
My laptop keyboard has a bug and it sometimes presses the number 5 randomly so i tried many things and they didn't work, I tried programming a code that can stop it but i couldn't because i am a beginner.
from pynput.keyboard import Key, Controller
keyboard = Controller()
disable = keyboard.pressed('5')
if deni:
KeyboardInterrupt
continue
希望这不需要导入
推荐答案
此问题不属于此处.您应该将其放在 https://superuser.com/中,因为在某些情况下这样做会更容易,更有效其他编程语言.但是,如果要使用python进行操作,请先学习python.
This question does not belong here. You should have put it in https://superuser.com/ as it would have been a whole lot easier and more effective to do it in some other programming language. But if you want to do it in python, first learn python.
- 尝试按"Fn和Num Lock";或如果您没有数字锁定"做"Fn和Caps Lock".
- 尝试重新安装键盘驱动程序.
- 如果键盘内部积水,则将其放入米中放置2至3天
- 购买新键盘
资源
- http://www.tomshardware.com/answers/id-1972361/keyboard-keys-typing-wrong-multiple-letters.html
这篇关于如何停止特定键在Python中的工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文