Skip to content

Instantly share code, notes, and snippets.

@stamaniorec
Created October 31, 2015 11:51
Show Gist options
  • Select an option

  • Save stamaniorec/249f13f524b6c641ca73 to your computer and use it in GitHub Desktop.

Select an option

Save stamaniorec/249f13f524b6c641ca73 to your computer and use it in GitHub Desktop.
#pygame draw text
font_size = 36
text_color = (10,10,10)
background_text_color = (255, 255, 255)
background = pygame.Surface(game_display.get_size())
if pygame.font:
font = pygame.font.Font(None, font_size)
text = font.render("Text", 1, text_color, background_text_color) # color and background
textpos = text.get_rect(centerx=background.get_width()/2, centery=background.get_height()/2)
# textpos = (50,50)
background.blit(text, textpos)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment