<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>
  • <tfoot id='iqV1h'></tfoot>

      1. <small id='iqV1h'></small><noframes id='iqV1h'>

      2. 检测 Python 中的键输入

        Detect key input in Python(检测 Python 中的键输入)
      3. <tfoot id='LDLfu'></tfoot>

      4. <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>

                    <tbody id='LDLfu'></tbody>
                  <legend id='LDLfu'><style id='LDLfu'><dir id='LDLfu'><q id='LDLfu'></q></dir></style></legend>

                  本文介绍了检测 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: Two modules and classes with the same name under different packages(python:不同包下同名的两个模块和类)
                  Configuring Python to use additional locations for site-packages(配置 Python 以使用站点包的其他位置)
                  How to structure python packages without repeating top level name for import(如何在不重复导入顶级名称的情况下构造python包)
                  Install python packages on OpenShift(在 OpenShift 上安装 python 包)
                  How to refresh sys.path?(如何刷新 sys.path?)
                  Distribute a Python package with a compiled dynamic shared library(分发带有已编译动态共享库的 Python 包)

                  • <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>

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