import pygame import math # Define the dimensions of the flag WIDTH, HEIGHT = 640, 480 # Define the colors RED = (255, 0, 0) WHITE = (255, 255, 255) BLUE = (0, 0, 255) # Initialize Pygame pygame.init() # Create the display screen = pygame.display.set_mode((WIDTH, HEIGHT)) # Fill the screen with white screen.fill(WHITE) # Draw the red stripes for i in range(13): pygame.draw.rect(screen, RED, (0, i*HEIGHT//13, WIDTH, HEIGHT//13)) # Draw the blue rectangle pygame.draw.rect(screen, BLUE, (0, 0, WIDTH//2, HEIGHT//7)) # Draw the white stars star_points = [] for i in range(5): angle = math.radians(-18 + i * 72) x = int(WIDTH / 4 + math.cos(angle) * WIDTH / 10) y = int(HEIGHT / 14 + math.sin(angle) * HEIGHT / 28) star_points.append((x, y)) angle += math.radians(36) x = int(WIDTH / 4 + math.cos(angle) * WIDTH / 20) y = int(HEIGHT / 14 + math.sin(angle) * HEIGHT / 40) star_points.append((x, y)) for i in range(9): for j in range(6): if (i + j) % 2 == 0: x = int(WIDTH / 8 + i * WIDTH / 16) y = int(HEIGHT / 14 + j * HEIGHT / 10) pygame.draw.polygon(screen, WHITE, star_points, int(HEIGHT / 28), (x, y)) # Update the screen pygame.display.update() # Wait for the user to close the window while True: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() exit()