Simple Python Graphics

If you haven’t done so already, download this file and copy it to your project folder (where-ever you are saving your Python source files). It’s a simple graphics library that we will ‘import’ in our projects.

Save this link as ‘graphics.py (<- Right-click and use ‘Save Link As…’ and make sure you call the file ‘graphics.py’)

Now you’re ready to code some graphics.

Download this file to your system and if everything is working, when you run it you will see a graphics window like this:

You can start editing the file to change sizes… colours… or anything else. Play around with the code and change the display:

  • Can you make the Square bigger and the circle smaller?
  • Can you make everything different shades of green?
  • Can you put the circle in the top-right corner?

When you think you’ve got it all sussed – try and draw a house.

If you want more details of the functions available see here: http://mcsp.wartburg.edu/zelle/python/graphics/graphics/index.html

If you want help working out the colour codes for your graphics use this page: https://www.w3schools.com/colors/colors_rgb.asp

This is an RGB colour picker and gives you the numbers you need to set any colour.