import pygame import sys # Initialize Pygame pygame.init() # Create display surface DISPLAYSURF = pygame.display.set_mode((400, 300)) pygame.display.set_caption('Hello World') # Main game loop while True: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit() # Fill the screen with a color (optional) DISPLAYSURF.fill((0, 0, 0)) # Black background # Create a small surface (rectangle) surface = pygame.Surface((50, 50)) # Create a surface surface.fill((0, 255, 0)) # Fill it with green color DISPLAYSURF.blit(surface, (175, 125)) # Draw it at (175, 125) # Update the display pygame.display.update()