# Drawing basic shapes

The following are the basic commands for drawing simple geometric shapes.

• `pygame.draw.line( window, colour, from-coordinates, to-coordinates, thickness )`
• `pygame.draw.rect( window, colour, ( top-left-x, top-left-y, width, height ), thickness )`
• `pygame.draw.circle( window, colour, ( centre-x, centre-y ), radius, thickness )`
• `pygame.draw.ellipse( window, colour, ( top-left-x, top-left-y, width, height ), thickness )`
• `pygame.draw.polygon( window, colour, ( list coordinates of vertices ) , thickness)`

(If thickness is left out, the shape will be filled in)

Coordinates are always provided as a set of (X,Y) values including their own set of parenthesis. That’s why when you look at the sample for pygame.draw.line below you can see that the from-coordinate is (50,60) and the to-coordinate is (50,160).

To have a go drawing some basic shapes:

• Start with a copy of the basic master template from the previous page.
• Add the following code AFTER the `line BLACK = (0,0,0)`
``````BLUE = (0,0,255)
GREEN = (0,255,0)
WHITE = (255,255,255)
RED = (255,0,0)
YELLOW = (255,255,0)
PINK = (0xFF, 0x65, 0xFF)
``````
• Add the following code AFTER the `window.fill(BLACK)` and BEFORE the `pygame.display.update()`
``````pygame.draw.line(window, BLUE, (50, 60), (50, 160), 10)
pygame.draw.rect(window, GREEN, (52, 160, 120, 40) )
pygame.draw.circle(window, WHITE, (110, 110), 40, 10)
pygame.draw.rect(window, YELLOW, (220, 100, 80, 40) )
pygame.draw.ellipse(window, PINK, (220, 100, 80, 40) )
pygame.draw.polygon(window, RED, ((20,20), (52,60), (172,60), (200,20)), 5)
``````

## Exercise

Can you draw a simple landscape scene? Perhaps a house with a triangle shaped roof, or a stick person?