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

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



diliup gabadamudalige wrote:
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?

It's almost certainly your imagination. The only thing you're
saving is a do-nothing trip around the event loop for each
event other than the ones you're interested in. Unless you're
getting events at an *extremely* high rate, I wouldn't expect
that to make a noticeable difference.

Also, if you do that, you'll need to somehow clear out all
the other event types, otherwise they'll eventually fill up
the buffer and you'll start losing events. You *could* do
that using event.clear() with a list of all the other event
types, but I really doubt whether it's worth the trouble.

--
Greg