import pygame, sys from pygame.locals import * pygame.init() # Define font object and render the text texT = pygame.font.SysFont("calibri", 20) text = texT.render("Hi", True, (0, 0, 0)) # Corrected text rendering DISPLAYSURF = pygame.display.set_mode((400, 300)) pygame.display.set_caption('Hello World!') while True: for event in pygame.event.get(): if event.type == QUIT: pygame.quit() sys.exit() # Corrected sys.exit() call DISPLAYSURF.fill((255, 255, 255)) # Optionally fill the background with white DISPLAYSURF.blit(text, (40, 40)) # Corrected to use DISPLAYSURF pygame.display.update()