<bdo id='ER10S'></bdo><ul id='ER10S'></ul>
    <legend id='ER10S'><style id='ER10S'><dir id='ER10S'><q id='ER10S'></q></dir></style></legend>

    <small id='ER10S'></small><noframes id='ER10S'>

      <tfoot id='ER10S'></tfoot>
    1. <i id='ER10S'><tr id='ER10S'><dt id='ER10S'><q id='ER10S'><span id='ER10S'><b id='ER10S'><form id='ER10S'><ins id='ER10S'></ins><ul id='ER10S'></ul><sub id='ER10S'></sub></form><legend id='ER10S'></legend><bdo id='ER10S'><pre id='ER10S'><center id='ER10S'></center></pre></bdo></b><th id='ER10S'></th></span></q></dt></tr></i><div id='ER10S'><tfoot id='ER10S'></tfoot><dl id='ER10S'><fieldset id='ER10S'></fieldset></dl></div>

      1. 如何在没有按键的情况下更改大写锁定状态

        时间:2023-09-12

          1. <tfoot id='OmseA'></tfoot>
              <tbody id='OmseA'></tbody>

            <small id='OmseA'></small><noframes id='OmseA'>

                <bdo id='OmseA'></bdo><ul id='OmseA'></ul>
                <i id='OmseA'><tr id='OmseA'><dt id='OmseA'><q id='OmseA'><span id='OmseA'><b id='OmseA'><form id='OmseA'><ins id='OmseA'></ins><ul id='OmseA'></ul><sub id='OmseA'></sub></form><legend id='OmseA'></legend><bdo id='OmseA'><pre id='OmseA'><center id='OmseA'></center></pre></bdo></b><th id='OmseA'></th></span></q></dt></tr></i><div id='OmseA'><tfoot id='OmseA'></tfoot><dl id='OmseA'><fieldset id='OmseA'></fieldset></dl></div>

                  <legend id='OmseA'><style id='OmseA'><dir id='OmseA'><q id='OmseA'></q></dir></style></legend>
                • 本文介绍了如何在没有按键的情况下更改大写锁定状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在使用一个在按下 Caps Lock 键时激活的 python 程序,我希望能够在程序处于活动状态时打开/关闭大写锁定状态.

                  I am using a python program that is activate when pressing Caps Lock key and I want to be able to turn on/off the caps lock status when the program is active.

                  我尝试使用 virtkey 发送密钥,但它显然不起作用,因为密钥只是激活应用程序并且不会更改大写锁定状态.那么使用 python 实现这一目标的最佳方法是什么?

                  I tried to send keys with virtkey but it obviously don't work since the keys just activate the app and don't change the caps lock status. So what is the best way to achieve this with python?

                  我正在使用 Ubuntu

                  I'm using Ubuntu

                  推荐答案

                  在 Linux 上:

                  import fcntl
                  import os
                  
                  KDSETLED = 0x4B32
                  
                  console_fd = os.open('/dev/console', os.O_NOCTTY)
                  
                  # Turn on caps lock
                  fcntl.ioctl(console_fd, KDSETLED, 0x04)
                  
                  # Turn off caps lock
                  fcntl.ioctl(console_fd, KDSETLED, 0)
                  

                  来源:Benji York - 堆栈内存溢出:在 Python 中更改键盘锁

                  在 Windows 上:

                  您应该能够为此使用 SendKeys,如下例所示:

                  You should be able to use SendKeys for this, as in the following example:

                  import SendKeys
                  
                  SendKeys.SendKeys("""
                  {CAPSLOCK}
                  """)
                  

                  这篇关于如何在没有按键的情况下更改大写锁定状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:使用 python xlib 全局捕获、忽略和发送 keyevents,识 下一篇:Python键盘库方向键问题

                  相关文章

                  最新文章

                  <tfoot id='IRI9t'></tfoot>
                  1. <i id='IRI9t'><tr id='IRI9t'><dt id='IRI9t'><q id='IRI9t'><span id='IRI9t'><b id='IRI9t'><form id='IRI9t'><ins id='IRI9t'></ins><ul id='IRI9t'></ul><sub id='IRI9t'></sub></form><legend id='IRI9t'></legend><bdo id='IRI9t'><pre id='IRI9t'><center id='IRI9t'></center></pre></bdo></b><th id='IRI9t'></th></span></q></dt></tr></i><div id='IRI9t'><tfoot id='IRI9t'></tfoot><dl id='IRI9t'><fieldset id='IRI9t'></fieldset></dl></div>

                    <small id='IRI9t'></small><noframes id='IRI9t'>

                      <legend id='IRI9t'><style id='IRI9t'><dir id='IRI9t'><q id='IRI9t'></q></dir></style></legend>
                        <bdo id='IRI9t'></bdo><ul id='IRI9t'></ul>