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

Re: [pygame] Problem with display.update(rectangle_list)



You are not processing events in the example script here - when you aren't processing events, then various platform specific window manager things that need to happen for your window to draw correctly don't get to happen.

If you don't need any of pygame's events, then you should just be calling pygame.event.pump() in each pass of your main loop, but most likely you'll ultimately want to be calling pygame.event.get() and iterating through the returned event list to respond to various things that can happen (like your window losing focus for instance)


On Wed, Jun 10, 2009 at 5:01 PM, Michael Leach <easily.remembered.name@gmail.com> wrote:
Hi, I'm fairly new to pygame, and I tried posting this before, but I
don't think it went through (sorry if this is the fourth posting... I'm having a fail-day).

The issue I'm having is with pygame.display.update(
rectangle_list). It
doesn't seem to update correctly when I pass a rectangle list with
some surface.get_rect()'s (specifically, the surfaces are rendered
fonts), but it works just fine with a drawn rectangle list passed in
or when I leave out the argument entirely.

The weirdest thing to me is that even the surface rectangles will work
if I move the window outside of the screen (as in I drag the pygame
window outside of my monitor space) and then bring it back to the
visible desktop. However, if I only drag it out partially, only the
part that left the screen will come back in updated correctly.

Here's some code that is a simplified version of mine:

while True:
                   print 'running loop'
                   rects = []
                   w,h = pygame.display.get_surface().get_size()
                   font = pygame.font.Font(None,92)
                   white = (255, 255, 255)

                   surface = font.render("WORDS HERE!",0, white)
                   rects.append(surface.get_rect())

                   X = w/2
                   Y = h*.5


                   pygame.display.get_surface().blit(surface, (X,Y))
                   #print rects
                   pygame.display.update(rects)

                   pygame.time.delay(100)




I must be doing this wrong because I've searched everywhere and come
up with nothing. I'm using pygame 1.8 with Vista x64 and some of the
best hardware on the market (i7, 4850x2, etc). Help is very much
appreciated!!