Hi,

I'm seeing a couple reasons why this might not work.

The most immediate problem is that you're getting the rect of the rendered
font's surface, but blitting it somewhere else (namely half the screen
away)--but the rendered font's surface itself might not be that big, and so
you see nothing--or only part of something.  Suppose, for instance, your
screen is sized (800,600).  "surface.get_rect()" might return a rect
(0,0,200,50).  You'd then blit this surface to the point (400,300),
modifying the pixels of the rectangle (400,300,200,50).  So, you'd want to
update the rect (400,300,200,50), not (0,0,200,50) in
pygame.display.update(rects).  That should solve the problem...I think...

The way you do some things also seems awkward.  For example, you're loading
the font each frame--which will cause performance problems later.  The whole
rect thing also pretty clunky.  Others might disagree with me here, but I
feel that pygame.display.update(rects) is best only when speed is incredibly
important.  Instead of keeping track of rects, I almost always perfer to
keep the code simpler, and just lazily call pygame.display.flip().

Here's the code that reflects this:

surface = pygame.display.set_mode(#blah)
surface_size = surface.get_size()

font = pygame.font.Font(None,92)

while True:
    rendered_font_surface = font.render("WORDS HERE!",(0,0,0),(255,255,255))

    surface.
blit(rendered_font_surface,(surface_size[0]/2,surface_size[1]/2))

    pygame.display.flip()

Hope this helps,
Ian

Reply via email to