import pygame, sys from pygame.locals import * pygame.init() screen = pygame.display.set_mode((400,300)) pygame.display.set_caption('Font') WHITE = (255,255,255) GREEN = (0, 255,0) BLUE = (0,0,255) fontObj = pygame.font.Font('freesansbold.ttf', 32) textSurfaceObj = fontObj.render('Hello World!', True, GREEN, BLUE) textRectObj = textSurfaceObj.get_rect() textRectObj.center = (200,150) while True: screen.fill(WHITE) screen.blit(textSurfaceObj, textRectObj) for event in pygame.event.get(): if event.type == QUIT: pygame.quit() sys.exit() pygame.display.flip() pygame.display.update()