ModX in event.state in tkinter?

ModX represents a modification, a Modifier Key.

In computing, a modifier key is a special key (or combination) on a
computer keyboard that temporarily modifies the normal action of
another key when pressed together. By themselves, modifier keys
usually do nothing; that is, pressing any of the ⇧ Shift, Alt, or Ctrl
keys alone does not (generally) trigger any action from the computer.

Tkinter is a crossplatform GUI-Toolkit and uses system specific facilities. Different OS using different methods, for example a PC that runs Linux signals Alt Gr as Mod 5 while a PC running Windows signals the same keystroke as Control-Alt. You can look at the Modifier Keys on tcl-lang.ord.

Event.state is a bit mask indicating which of certain modifier keys and mouse buttons were down or active when the event triggered and is not reliable because of the system specific facilities as pointed out here.

Leave a Comment