import pygame pygame.init() screen = pygame.display.set_mode((640, 480)) pygame.display.set_caption("Display Text") clock = pygame.time.Clock() BG = (20, 20, 20) WHITE = (255, 255, 255) # pygame.font.SysFont(font_name, size) — use None for the default font font_large = pygame.font.SysFont(None, 64) font_small = pygame.font.SysFont(None, 32) running = True while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False screen.fill(BG) # render() returns a Surface; blit() draws it onto the screen title_surf = font_large.render("Hello, pygame!", True, WHITE) screen.blit(title_surf, (100, 180)) hint_surf = font_small.render("Close the window to quit.", True, (160, 160, 160)) screen.blit(hint_surf, (170, 270)) pygame.display.flip() clock.tick(60) pygame.quit()