[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
RE: [pygame] 100% CPU FAQ
> -----Original Message-----
> From: owner-pygame-users@xxxxxxxx [mailto:owner-pygame-users@xxxxxxxx]
> On Behalf Of techtonik
> Sent: Thursday, July 31, 2008 4:09 AM
> To: pygame-users@xxxxxxxx
> Subject: Re: [pygame] 100% CPU FAQ
>
> On Thu, Jul 31, 2008 at 11:31 AM, Noah Kantrowitz <noah@xxxxxxxxxxxxxx>
> wrote:
>
> >>
> >> The following example shows 100% load even with empty event queue
> when
> >> pygame.event.get() is blocking.
> >
> > That would be because event.get() doesn't block. If you want to
> control your
> > framerate (and therefore CPU usage) use pygame.time.Clock.
> >
>
> If it doesn't block when why print time is executed only when I pass
> mouse over the window?
In your original sample you had the main body of the game code indented inside the event for loop. I had assumed it was a paste error, but from what you said, maybe it wasn't.
--Noah