我在为我的程序创建键盘快捷键时遇到问题。我似乎无法获得 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
其中之一:
-
root.bind("<控制-Shift_L><S>",function) -
root.bind("<控制-Shift_R><S>",function) -
root.bind("<控制-Shift-S>",function)
( Reference )
