ymk369
0
Q:

how to render text in pygame

font = pygame.font.Font('freesansbold.ttf', 32)
text = font.render(text, True, textColor, backgroundColor)
textRect = text.get_rect()
textRect.center = (x,y)
screen.blit(text, textRect)
pygame.display.update()
5
font = pygame.font.Font("PATH_TO_FONT", PX_SIZE)
textsurface = font.render("TEXT", False, COLOR)  # "text", antialias, color
surface.blit(textsurface, (x, y))
4
pygame.font.init() # you have to call this at the start, 
                   # if you want to use this module.
myfont = pygame.font.SysFont('Comic Sans MS', 30)

textsurface = myfont.render('Some Text', False, (0, 0, 0))

screen.blit(textsurface,(0,0))
0

New to Communities?

Join the community