Tkinter:创建键盘快捷键的问题

Tkinter : Issue with creating keyboard shortcuts

我在为我的程序创建键盘快捷键时遇到问题。我似乎无法让 root.bind("<Control-Shift-s>",function) 工作,但 root.bind("<Control-s>",function) 工作得很好。这是示例代码:

from tkinter import *

root = Tk()
def function():
    print("This is a function")

root.bind("<Control-Shift-s>",function) # Doesn't work
root.bind("<Control-s>",function) # Works perfectly

root.mainloop()

变化:

root.bind("<Control-Shift-s>",function) # Doesn't work

其中之一:

  1. root.bind("<控制-Shift_L><S>",function)
  2. root.bind("<控制-Shift_R><S>",function)
  3. root.bind("<Control-Shift-S>",function)

(Reference)