import pygame import sys pygame.init() display = pygame.display.set_mode((300,300)) display.fill((255,255,255)) # Drawing a series of connected lines on the display surface using Pygame's draw.lines() function. pygame.draw.lines(display, (0,0,255), closed=True, points=[(20,20), (60,120), (200,180)]) # display: The surface to draw the lines on. # (0, 0, 255): The color of the lines in RGB format, here it represents blue color. # closed=True: Indicates whether the lines should form a closed shape or remain open. # When set to True, the lines will connect the last point to the first point, # forming a closed shape. # points=[(20, 20), (60, 120), (200, 180)]: The list of points that define the vertices of the lines. # Each point is represented as a tuple (x, y) coordinate. # The lines will be drawn between consecutive points in the list. while True: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit() pygame.display.update()