1

For amusement, I'm wring a python pygame program. I wanted to add keyboard shortcuts as an alternative to using the mouse to click the buttons. When investigating this I was looking at the event.mod types that can act as modifiers on the keys (i.e. alt, ctrl, shift, num lock, etc.). They are pretty straightforward except for one.

I cannot figure out what key the modifier pygame.KMOD_MODE is intended to indicate is being pressed. This is the list of modifiers, and it is the last one.

Constant      Description
-------------------------
KMOD_NONE     no modifier keys pressed
KMOD_LSHIFT   left shift
KMOD_RSHIFT   right shift
KMOD_SHIFT    left shift or right shift or both
KMOD_LCTRL    left control
KMOD_RCTRL    right control
KMOD_CTRL     left control or right control or both
KMOD_LALT     left alt
KMOD_RALT     right alt
KMOD_ALT      left alt or right alt or both
KMOD_LMETA    left meta
KMOD_RMETA    right meta
KMOD_META     left meta or right meta or both
KMOD_CAPS     caps lock
KMOD_NUM      num lock
KMOD_MODE     mode

The numeric value of the flag is hex 0x4000, but that's just a mapping and doesn't indicate what triggers the modifier flag getting set.

I have been searching around but cannot find anything that uses or explains what this is intended to indicate. Of course I can just ignore it since this is just for fun and not a 'real' project, but I really would like to understand what this is.

Anyone know what key would trigger this modifier?

Glenn Mackintosh
  • 2,765
  • 1
  • 10
  • 18

1 Answers1

3

Not a definitive answer here, but Simple DirectMedia Layer maps KMOD_MODE to 'AltGr'. AltGr seems to be relevant to international\multi-locale keyboards, though it seems some operating systems have alternate keystrokes to achieve the same thing, e.g. AltGr key not working, instead i have to use Ctrl+AltGr

If you don't have a keyboard with the AltGr key handy, try some of the alternative key combos and see if PyGame responds accordingly.

user2585435
  • 131
  • 1
  • 8
  • Thanks, for the response! This does appear to be the answer. As I understand it, pygame is a wrapper around SDL, so that definition of what it is in SDL should translate through to pygame as well. My need to know is now sated :-) I am going to mark this as the answer. – Glenn Mackintosh Apr 20 '20 at 13:58
  • I have gotten it fixed on GitHub now, but it does not seem to have made its way to the online docs at pygame.org yet. – Glenn Mackintosh Apr 25 '20 at 14:20