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

Re: [pygame] 100% CPU FAQ



Noah Kantrowitz wrote:
If you want to control your framerate (and therefore CPU usage) use pygame.time.Clock.

Alternatively, use pygame.time.set_timer to arrange for a
USEREVENT to be sent at regular intervals.

In your event loop, use pygame.event.wait(), which does
block (but only returns one event at a time).

If you want to get multiple events in one go, use
pygame.event.wait() to get the first one, then call
pygame.event.get() to get any others that have been
put in the queue since the last time round the event
loop.

--
Greg