Fill the Screen with Colour

screen.fill(color)

 

Drawing a line example

pygame.draw.line(screen, COLOUR, [from_x, from_y], [to_x, to_y], line_thickness)

This example will draw a line that is black from the point 100, 100 to the point 200, 200.  The thickness of the line is 10 pixels.

pygame.draw.line(screen, BLACK, [100, 100], [200, 200], 10)

 

Drawing a Rectangle Example

pygame.draw.rect(screen, COLOUR, [x, y, width, height], line_thickness)

This example will draw a rectangle as a line 

pygame.draw.rect(screen, WHITE, [100, 100, 400, 300], 2)

This example will draw a rectangle that is filled in.

pygame.draw.rect(screen, WHITE, [100, 100, 400, 300])

 

Drawing a Circle Example

pygame.draw.circle(screen, COLOUR, [x, y], radius, line_thickness)

This example will draw a rectangle as a line 

pygame.draw.circle(screen, RED, [100, 100], 50, 10)

This example will draw a circle that is filled in.

pygame.draw.circle(screen, (255, 0, 0), [100, 100], radius)

 

Drawing a Ellipse Example

pygame.draw.ellipse(screen, COLOUR, [x, y, width, height] line_thickness)

This example will draw a rectangle as a line 

pygame.draw.ellipse(screen, RED, [100, 100, 100, 50], 10)

This example will draw a circle that is filled in.

pygame.draw.ellipse(screen, WHITE, [100, 100, 200, 50])

 

Drawing a Polygon Example

pygame.draw.polygon(screen, COLOUR, point list, line_thickness)

This example will draw a polygon as a line 

pygame.draw.polygon(screen, WHITE, [[100, 100], [100, 400],[400, 300]], 2)

This example will draw a polygon that is filled in.

pygame.draw.polygon(screen, WHITE, [[100, 100], [100, 400],[400, 300]], 2)

 

Drawing an Arc Example

pygame.draw.arc(screen, color, (x,y,width,height), start_angle, stop_angle, thickness)

This example will draw an arc as a line

pygame.draw.arc(screen, BLUE, (50,50,200,300), 20, 20, 1)

This example will draw an arc filled in

pygame.draw.arc(screen, BLUE, (50,50,200,300), 20, 20)