سؤال

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