[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Re: Pygame not handling keyboard tracking correctly



If I use the keyboard scan routine in several places in the main program will that help?


On Sun, Jun 22, 2014 at 4:50 PM, Sam Bull <sam.hacking@xxxxxxxx> wrote:
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.



--
Diliup Gabadamudalige

http://www.diliupg.com
http://soft.diliupg.com/

**********************************************************************************************
This e-mail is confidential. It may also be legally privileged. If you are not the intended recipient or have received it in error, please delete it and all copies from your system and notify the sender immediately by return e-mail. Any unauthorized reading, reproducing, printing or further dissemination of this e-mail or its contents is strictly prohibited and may be unlawful. Internet communications cannot be guaranteed to be timely, secure, error or virus-free. The sender does not accept liability for any errors or omissions.
**********************************************************************************************