Skip to content
Advertisement

Use opt/ cmd + Backspace in tkinter

I have a very simple notepad that is made out of the tk.text widget.

The only thing lacking is OPT/ CMD + Backspace support on Mac (deleting lines and words).

Any way i could add support for it? either through tkinter directly or though a selfmade function?

EDIT: I also found out that navigating text using OPT and the arrow keys work, why it doesnt work in combination with Backspace i dont know.

Advertisement

Answer

As it turns out, there are modifier keys that bound to Mac keys(source):

The Command and Option modifiers are equivalents of Mod1 resp. Mod2, they correspond to Macintosh-specific modifier keys.

this means that if you want to use CMD/ OPT on Mac you can use Mod1 & Mod2 like any other key:

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