import pygame, sys pygame.init() display = pygame.display.set_mode((300,300)) display.fill((255,255,255)) # Drawing a rectangle with rounded corners on the display surface using Pygame's draw.rect() function. pygame.draw.rect(display, (0,0,255), (40,80,200,80), width=0, border_radius=20) # display: The surface to draw the rectangle on. # (0, 0, 255): The color of the rectangle in RGB format, here it represents blue color. # (40, 80, 200, 80): The bounding rectangle for the rectangle with rounded corners. # It defines the position and dimensions of the rectangle. # The parameters represent (left, top, width, height) of the rectangle. # Here, the rectangle is positioned at (40, 80) with a width of 200 pixels # and a height of 80 pixels. # width=0: The width of the outline of the rectangle. # Setting it to 0 means that the rectangle will be filled with the specified color. # border_radius=20: The radius of the rounded corners of the rectangle. # Here, it's set to 20 pixels. while True: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit() pygame.display.update()