What's the Linux version of "<Control-Shift-u>" for keybindings in Tkinter? You might be tempted to think it's exactly that, but, alas, it does not seem to be. For instance, the Linux version of "<Control-Shift-Tab>" is "<Control-ISO_Left_Tab>". I've searched and haven't found any documentation for this.

有帮助吗?

解决方案

The following will do what you want:

from Tkinter import *

def proof(event=None):
    print 'ping'

root = Tk()

frame = Frame(root, height=100, width=100)
frame.focus_set()
frame.bind('<Control-Shift-KeyPress-U>', proof)
frame.pack()

root.mainloop()

The u becomes capitalized because of the shift modifier and you want to capture the KeyPress event.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top