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

Re: [pygame] consistent heartbeats



andrew baker wrote:

ImageGrab() FYI). You're referring to PIL's ImageGrab(), innit? In my experience, I couldn't even get PIL to grab a large image more than once every second or so, but that's probably due to my low-spec machine.


I've had good experience with a simple time.wait(DELAY - time_elapsed) loop in smoothing out my main loop. I'm not really sure how precise it is, but someone on the list dropped figures like 10% s.d., so that's about 100 ms +/- if I understand correctly. That might be "close enough for funk."

As for ImageGrab, why not instead do:

new_surface = pygame.surface.Surface(SCREEN_SIZE)
new_surface.blit( the_screen, (0,0) )

Which copies the current contents of the screen to the new_surface.