I’m currently working on a Pygame project (will post again as soon as it’s done! ), and I’m now in the process of implementing the high score entry feature. One of my concerns was how to get keyboard input – while there are many examples of how to get keyboard input through the event loop, I thought that it would be a hassle to check for every key (K_a, K_b, etc…) after checking for a KEYDOWN event.
Of course, I still think that the best source for Pygame event-handling information is the EventList program that comes with the Pygame examples, which may be obtained from the Pygame Documentation Windows Installer or the Pygame Source Package. So I went through the EventList code, and came up with this:
This very simple program, which is a slightly modified version of the barebones pygame program, implements a very simple typing game. I hope that you will find this code useful, and perhaps this can be the start of a complete typing game!