Use a timer, but just use the builtin clock.tick(), no need to get fancy with events.
On Tue, Dec 20, 2016 at 9:07 AM, Martin Kühne <mysat...@gmail.com> wrote: > Use timers so you don't run on 100% CPU: > > TIMER = pygame.NUMEVENT - 1 > pygame.time.set_timer(TIMER, 50) > > def show(self): > # this is a simple frame dropping logic, so that the event queue > empties per call of show() > # and within the time specified by pygame.time.set_timer > updated=False > for event in [pygame.event.wait(), *pygame.event.get()]: > if event.type == QUIT: > exit() > elif event.type == TIMER and not updated: > updated = True > # update graphic here > pygame.display.update() > > > I do find it surprising that pygame should be creating a memory leak > in this case, since none of the pygame functions you use, > pygame.event.get, pygame.Surface.fill, pygame.draw.rect are ones which > one would expect to permanently allocate memory for any obvious > reason. > > cheers! > mar77i >