On lun, 2014-06-23 at 18:14 +1200, Greg Ewing wrote: > 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?
If those are the only event types you are interested in across your whole program, then the most efficient and convenient method is to use set_allowed(): http://www.pygame.org/docs/ref/event.html#pygame.event.set_allowed This will stop any other event type going into the queue. This means you don't need to process the other events in your loop, like with your get(typelist) method. But, it also means the queue will never fill up, and you won't have to worry about clearing it. With only the event types you want allowed to enter the queue, you can just use a plain event.get() to get everything, as it will only include the allowed events.
signature.asc
Description: This is a digitally signed message part