如何停止特定键在Python中的工作 [英] How to stop a specific key from working in Python

查看:88
本文介绍了如何停止特定键在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.

  1. 尝试按"Fn和Num Lock";或如果您没有数字锁定"做"Fn和Caps Lock".
  2. 尝试重新安装键盘驱动程序.
  3. 如果键盘内部积水,则将其放入米中放置2至3天
  4. 购买新键盘

资源

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