[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] 100% CPU FAQ
- To: pygame-users@xxxxxxxx
- Subject: [pygame] 100% CPU FAQ
- From: techtonik <techtonik@xxxxxxxxx>
- Date: Thu, 31 Jul 2008 10:24:20 +0200
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Thu, 31 Jul 2008 04:24:25 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=6Cr+qANseSWTkyBRKP7f49NbNQNkb0g3CbRLoFYE8n4=; b=tu74Q8ewMC1vG0U9RseVWBWymmATXQ+5Unk7QNKT73CDZEUZXJNXCE6mZmF+ryti4g JMdiyTali2Lyahn7WqqvFafGeThsY8fsZ+B+I3R32jjYqHT8FBXF8ja9zDjJEEnLmb0x L0Y/4FA3M+7+mByc02wQYFQGA7H0no4VX61/Y=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=Zf2WBvrEitghohbjTXhUxcoLABLof78ua7EIWPq8RX1vwAGhqB7SaW7Cp8ufDYMb/a VqBvz9e2jfj+oRVFO6b7dJt+CbHbJr/A/9udIktqfH69AqbfNBa3TZskXXrUXTEh9B2i XdPh0qgi4KLOkc0rS83UHzceusbKhUcI09GOY=
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Hello,
I do not know why this question is not present in FAQ yet, but - why
pygame always eats 100% of CPU time?
The following example shows 100% load even with empty event queue when
pygame.event.get() is blocking.
import time
if __name__ == "__main__":
import pygame
pygame.init()
size = width, height = 750, 550
screen = pygame.display.set_mode(size)
bgcolor = 90, 90, 90
game_quit = False
while not game_quit:
for ev in pygame.event.get():
if ev.type == pygame.QUIT:
game_quit = True
print time.time()
screen.fill(bgcolor)
pygame.display.flip()
--
--anatoly t.