I noticed that when you launch script with pygame, every button's keycode 'sticks' to keyboard layout language. That makes it impossible to detect key pressing if script didn't start in latin, as keycode no more matches something code expects.
I tried code below and it will print 113 if I start with latin layout and press 'q', even if I change layout to cyrillic and press 'й'. But if I start with cyrillic layout and press 'й' it will print 1081, even if I change layout to latin and press 'q'.
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
print(event.key)
All that means that if I start with cyrillic layout script will print 1081, if I start with latin layout it will print 113, and if I start with other layout it will print other number.
event object also has scancode and unicode, I think that may be useful.
Is there a way to bypass this?
pygame.key.get_pressed() also doesn't work as it compares same keycodes, so q's keycode 113 != й's keycode 1081