I'm making a multiplayer platformer/shooter/brawl game with pygame and I'd like for the players to easily change their keybinds (such as from a config file).
I haven't been able to find a way to read a character string and use that as a transition to the
pygame.K_xx objects as of now so I ask the community.
Any leads ?Answer1:
With the constants of <a href="https://www.pygame.org/docs/ref/key.html" rel="nofollow">this list</a> you can use
getattr(pygame, 'K_'+ mychar)
to access a constant by name.