如何在python tkinter中绑定Ctrl +/? [英] How to bind Ctrl+/ in python tkinter?

查看:191
本文介绍了如何在python tkinter中绑定Ctrl +/?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<Control-Shift-Key-0>
<Control-Key-plus>

有效,但

<Control-Key-/>

没有.

我无法在python中绑定 ctrl + /.是否有所有可能的键的文档?

I am unable to bind ctrl + / in python. Is there any documentation of all the possible keys?

推荐答案

使用<Control-slash>:

def quit(event):
    print "you pressed control-forwardslash"
    root.quit()

root = tk.Tk()
root.bind('<Control-slash>', quit)      # forward-slash
# root.bind('<Control-backslash>', quit)  # backslash
root.mainloop()


我没有指向这些事件名称的完整列表的链接.这是我收集的部分清单:


I don't have a link to a complete list of these event names. Here is a partial list I've collected:

| event                 | name                  |
| Ctrl-c                | Control-c             |
| Ctrl-/                | Control-slash         |
| Ctrl-\                | Control-backslash     |
| Ctrl+(Mouse Button-1) | Control-1             |
| Ctrl-1                | Control-Key-1         |
| Enter key             | Return                |
|                       | Button-1              |
|                       | ButtonRelease-1       |
|                       | Home                  |
|                       | Up, Down, Left, Right |
|                       | Configure             |
| window exposed        | Expose                |
| mouse enters widget   | Enter                 |
| mouse leaves widget   | Leave                 |
|                       | Key                   |
|                       | Tab                   |
|                       | space                 |
|                       | BackSpace             |
|                       | KeyRelease-BackSpace  |
| any key release       | KeyRelease            |
| escape                | Escape                |
|                       | F1                    |
|                       | Alt-h                 |

这篇关于如何在python tkinter中绑定Ctrl +/?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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