Overlayed text

for some reason i cant get text written over a white background:±--------+
| text |
±--------+
| |
| |
±--------+

only the top background part is white, the rest is painted by a different
part of the program.

here is (almost) the code i have now:

(written with pygame, but basically the same)

text = self.font.render(self.name, 1, (255, 0, 0))
print 1

textpos = text.get_rect()
print 2

w=640

h=60

#w=self.owner.frame.background.get_rect().right 

#h=textpos.height

print 3

self.owner.frame.background.fill ((255,255,255),  [0, 0, w, 60])

pygame.display.update ()

print 4

self.owner.frame.background.blit (text, (1,1)) #textpos.topleft)


etoffi

hiya etoffi. we’ve got a pygame mailing list, which would be a great
place if you want to follow this up any further :]
http://www.seul.org/archives/pygame/users/

for some reason i cant get text written over a white background:
here is (almost) the code i have now:
(written with pygame, but basically the same)

text = self.font.render(self.name, 1, (255, 0, 0))
self.owner.frame.background.fill ((255,255,255), [0, 0, 640, 60])
pygame.display.update ()
self.owner.frame.background.blit (text, (1,1))

your problem here is that your are blitting the text after you
update the display. swap those last two lines around.

also, if the background is solid white, your performance will be much
better off sending that white background color to the font render function.

text = self.font.render(self.name, 1, (255, 0, 0), (255, 255, 255))