I'm trying to make a calculator app with Tkinter, and have successfully bound all other key in this way, but I'm unable to bind my "-" key, I know that it's currently reading it as any character, and that I should probably escape it, but I don't know how.
root.bind("<KeyPress-->", lambda event: color_press(bsub, 'activebackground'))
I've already tried
root.bind("<KeyPress-\->", lambda event: color_press(bsub, 'activebackground'))
unsure what to do
CodePudding user response:
Try this
root.bind("<KeyPress-minus>", lambda event: color_press(bsub, 'activebackground'))