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

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



thank you Greg. Noted and will correct now.

Thank you Jake B. I commented out the Âevent pump and modified the next line to this

def get_keys():

#pygame.event.pump()

#mouse buttons left-1, middle-2, right-3
for event in pygame.event.get([KEYDOWN, KEYUP, MOUSEMOTION, MOUSEBUTTONUP]):

so far works well. I also noted a slight increase in speed. Is that my imagination or could specifying the events looked at speed up the process?


On Mon, Jun 23, 2014 at 11:23 AM, Greg Ewing <greg.ewing@xxxxxxxxxxxxxxxx> wrote:
Jeffrey Kleykamp wrote:
Although it looks like the "KEYUP" events don't have a unicode

That is very true, which means this won't work at all:


  if event.type is KEYUP:
    x = event.unicode

Also, it's a bad idea to use 'is' to compare ints. It
may appear to work in this case, but it's only working
by accident. You should do this instead:

 Âif event.type == KEYUP:
   ...

--
Greg



--
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.
**********************************************************************************************