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

[pygame] Why does pygame get so high CPU usage?



I tried to do a simple image viewer in pygame, but it wasn't very
functional:




import pygame,   sys
from pygame.locals import*

im= pygame.image.load('c:/game/eliza.png')

screen= pygame.display.set_mode((im.get_width(), im.get_height()),
ASYNCBLIT)
screen.blit(im, (0,0))
pygame.display.update()

while 1:
    for event in pygame.event.get(QUIT):
        sys.exit()
    pygame.event.pump()



The problem is that python gets ~99% cpu usage when this is running.
And it is quite interesting because it does nothing other than
checking for QUIT events. I even tried to put nothing but 'pass' in
the loop but no luck. Any suggestions?