【发布时间】:2013-04-18 11:54:46
【问题描述】:
<Control-Shift-Key-0>
<Control-Key-plus>
有效但
<Control-Key-/>
没有。
我无法在 python 中绑定 ctrl + /。是否有所有可能键的文档?
【问题讨论】:
标签: python key-bindings
<Control-Shift-Key-0>
<Control-Key-plus>
有效但
<Control-Key-/>
没有。
我无法在 python 中绑定 ctrl + /。是否有所有可能键的文档?
【问题讨论】:
标签: python key-bindings
使用<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()
我没有指向这些事件名称的完整列表的链接。这是我收集的部分列表:
| 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 |
【讨论】:
<Control-backslash>。
Command+Down 绑定。请参阅effbot.org/tkinterbook/tkinter-events-and-bindings.htm(搜索“覆盖”一词)。
这里是所有 tk keysysm 代码的列表: https://www.tcl.tk/man/tcl8.6/TkCmd/keysyms.htm
我要找的两个是<Win_L> 和<Win_R>。
【讨论】: