Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pygame center text in rect

# draw text
font = pygame.font.Font(None, 25)
text = font.render("You win!", True, BLACK)
text_rect = text.get_rect(center=(SCREEN_WIDTH/2, SCREEN_HEIGHT/2))
screen.blit(text, text_rect)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pygame #center #text #rect
ADD COMMENT
Topic
Name
6+9 =