• <tfoot id='LDLfu'></tfoot>

  • <small id='LDLfu'></small><noframes id='LDLfu'>

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

      1. <legend id='LDLfu'><style id='LDLfu'><dir id='LDLfu'><q id='LDLfu'></q></dir></style></legend>

        检测 Python 中的键输入

        时间:2023-09-12
        <i id='iqV1h'><tr id='iqV1h'><dt id='iqV1h'><q id='iqV1h'><span id='iqV1h'><b id='iqV1h'><form id='iqV1h'><ins id='iqV1h'></ins><ul id='iqV1h'></ul><sub id='iqV1h'></sub></form><legend id='iqV1h'></legend><bdo id='iqV1h'><pre id='iqV1h'><center id='iqV1h'></center></pre></bdo></b><th id='iqV1h'></th></span></q></dt></tr></i><div id='iqV1h'><tfoot id='iqV1h'></tfoot><dl id='iqV1h'><fieldset id='iqV1h'></fieldset></dl></div>

        <legend id='iqV1h'><style id='iqV1h'><dir id='iqV1h'><q id='iqV1h'></q></dir></style></legend>
            <bdo id='iqV1h'></bdo><ul id='iqV1h'></ul>
              <tbody id='iqV1h'></tbody>
          • <tfoot id='iqV1h'></tfoot>

                • <small id='iqV1h'></small><noframes id='iqV1h'>

                • 本文介绍了检测 Python 中的键输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  (2013 年) 不知道为什么 Python 这么奇怪,google 搜不到这个,但是很简单.

                  (In 2013) I don't know why Python is that weird, you can't find this by searching in google very easily, but it's quite simple.

                  如何检测SPACE"或任何键?我该怎么做:

                  How can I detect 'SPACE' or actually any key? How can I do this:

                  print('You pressed %s' % key)
                  

                  这应该包含在python核心中,所以请不要链接与核心python无关的模块.

                  This should be included in python core, so please do not link modules not related for core python.

                  推荐答案

                  你可以做一个小 Tkinter 应用:

                  You could make a little Tkinter app:

                  import Tkinter as tk
                  
                  def onKeyPress(event):
                      text.insert('end', 'You pressed %s
                  ' % (event.char, ))
                  
                  root = tk.Tk()
                  root.geometry('300x200')
                  text = tk.Text(root, background='black', foreground='white', font=('Comic Sans MS', 12))
                  text.pack()
                  root.bind('<KeyPress>', onKeyPress)
                  root.mainloop()
                  

                  这篇关于检测 Python 中的键输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:我们可以在 python selenium webdriver 中缩放浏览器窗 下一篇:使用 Python 2.6 设置全局热键

                  相关文章

                  最新文章

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

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

                    <bdo id='FnusO'></bdo><ul id='FnusO'></ul>

                  <tfoot id='FnusO'></tfoot>