+ 1
pygame
How can i place some lines or words in window in pygame?
1 Resposta
+ 3
You can use pygame.font module.
#First you need to make font (this don't need to be repeated):
font = pygame.font.Font(None, <font_size>)
This is needed to be done once per text:
text_surface = font.render(<text string>, 1, <color (R, G, B)>
text_rect = text_surface.get_rect()
And this is repeated each time you want to draw the text on surface:
surface.blit(text_surface, text_rect)
You can move the text by:
text_rect.move_ip(<xpos>, <ypos>)