在 Python 中更改键盘锁 [英] Change keyboard locks in Python

查看:25
本文介绍了在 Python 中更改键盘锁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Python 中,有什么方法可以以编程方式更改 CAPS LOCK/NUM LOCK/SCROLL LOCK 状态?

Is there any way, in Python, to programmatically change the CAPS LOCK/NUM LOCK/SCROLL LOCK states?

这不是一个真正的笑话问题 - 更像是一个真正的笑话程序问题.我打算用它来让灯光做一些有趣的事情...

This isn't really a joke question - more like a real question for a joke program. I intend to use it for making the lights do funny things...

推荐答案

如果您使用的是 Windows,您可以使用 SendKeys 我相信.

If you're using windows you can use SendKeys for this I believe.

http://www.rutherfurd.net/python/sendkeys

import SendKeys

SendKeys.SendKeys("""
{CAPSLOCK}
{SCROLLOCK}
{NUMLOCK}
""")

这篇关于在 Python 中更改键盘锁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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