Skip to content
Advertisement

Why can’t I bind the control key and plus key to a Tkinter text widget in Python?

Basically I wanted to bind two keys to a text widget those keys are the control key and the plus key.

This is what I tried:

Textbox1.bind("<Control-plus>", DoSomething)

This for whatever reason doesn’t work.

It doesn’t go to my function and it doesn’t return any errors if you were wondering.

But for some other reason this works:

Textbox1.bind("<Control-minus>", DoSomething)

Why is this?

And how can I bind the control key and plus key?

Advertisement

Answer

I don’t know what system you use but on Linux normally to display + you have to use Shift = – and this can make problem.

<Control-plus> means Ctrl Shift =

<Control-equal> means Ctrl = (which can means Ctrl + for you)

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement