我想将一个Control+1序列绑定到一个窗口。widget.bind("<Control-1>", lambda event: someFunction(event))
绑定Control + Left Mouse Click。这是我的代码片段,将使用它:
self.master.bind("<Control-1>", lambda event: self.allTypeButtons[1].invoke())
self.master.bind("<Control-2>", lambda event: self.allTypeButtons[2].invoke())
self.master.bind("<Control-3>", lambda event: self.allTypeButtons[3].invoke())
# self.allTypeButtons is a dictionary with Radiobuttons as its values
我也试过self.master.bind("<Control>-1", lambda event: self.allTypeButtons[1].invoke())
了,但这给了我:_tkinter.TclError: bad event type or keysym "Control"
。
此外,self.master.bind("Control-1", lambda event: self.allTypeButtons[1].invoke())
然后按Control+1不会调用该事件。
我知道widget.bind("1", lambda event: someFunction(event))
绑定1、 widget.bind("<1>", lambda event: someFunction(event))
绑定Left Mouse Click和widget.bind("<Control-h>", lambda event: someFunction(event))
绑定Control+h,但我该如何合并Control+1?提前致谢。