writing text inside a rect pygame code example
Example: how to render text in pygame
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))