<Control-Shift-Key-0>
<Control-Key-plus>
的作品,但如何在python tkinter中绑定Ctrl + /?
<Control-Key-/>
没有。
我无法绑定ctrl + / in python。有没有关于所有可能的钥匙的文件?
<Control-Shift-Key-0>
<Control-Key-plus>
的作品,但如何在python tkinter中绑定Ctrl + /?
<Control-Key-/>
没有。
我无法绑定ctrl + / in python。有没有关于所有可能的钥匙的文件?
使用<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 |
这里是所有的TK keysysm代码列表: https://www.tcl.tk/man/tcl8.6/TkCmd/keysyms.htm
两个我一直在寻找的是<Win_L>
和<Win_R>
。
这是一个非常有用的资源,用它来找到如何绑定释放一个Ctrl按钮。 – Siwel
那么如何添加反斜杠作为绑定? –
使用''。 –
unutbu
如何为mac执行command +向下箭头? – Joop