On dim, 2014-06-22 at 13:13 +0530, diliup gabadamudalige wrote: > Still, if I play the keyboard really fast there are stuck MIDI notes > and stuck animations. > What could be the reason?
First thing you could do, is to check if the events are coming in correctly. At the top of the event loop, just add a print statement 'print(event.key, event.type)', and then check the output to see if you get all the KEYUP events for each key following their KEYDOWN events. If they're all there, and in the right order, then it is a problem with your code, otherwise it might just be missing events. I don't know if SDL/Pygame is supposed to guarantee these events or not, it could also be possible that it's just overflowing the keyboard buffer or something. It's also worth noting, though doesn't sound like the problem you're having, that you don't receive keyboard events when the window loses focus, so you could press a button, lose focus, let go of the key, regain focus, and it would never receive the KEYUP event.
signature.asc
Description: This is a digitally signed message part