Programming Resources
For Fun and Learning
Charles Cusack
Computer Science
Hope College
main


Python


C++
JAVA
PHP
SQL
Alice

Turtle


Description

This page has sample files for drawing using Python Turtle.

  • The numbered scripts draw abstract art. The other ones contain "helper" methods.
  • Except for 001_FirstTurtle.py, the rest need one or more of the following files to be present:
    • util.py
    • palettes.py
    • colors.py
    • drawMethods.py
    so download those and put them it in your project directory.
  • You will need to install a packaged called PIL (the package is usually called pillow instead of PIL for some reason) in order to run these scripts. How to do that depends on what IDE you are using. This packages allows you to take screenshots of your scripts by just clicking anywhere in the window. It will name the files the same name as the script, so if you do it multiple times it will overwrite previously saved images. Rename your images to avoid this.
Getting Started with Python Turtle
  1. Download a suitable IDE for working with Python. I use PyCharm
  2. Download the Python Turtle Starter Files and extract the files.
  3. Drag the four files into your project folder.
    1. 001_FirstTurtle.py is very basic and just draws two shapes.
    2. 002_CheckerBoard.py draws a simple checkerboard.
    3. 003_ColoredSquares.py draws a colored checkerboard.
    4. util.py contains a couple of methods that are used in 002_CheckerBoard.py and 003_ColoredSquares.py to make the window better. I recommend that you use the getTurtleAndScreen method to get your turtle/screen objects in all of your code as is done in these two scripts.
  4. Run these and look at the code. Then start making your own!
  5. See Turtle Graphics Documentation to see more about what Turtles can do.
  6. I recommend numbering your files like I did (e.g. 001_FirstTurtle, 002_CheckerBoard, 003_MyCoolOne, etc.), and every time you make tweaks that change it significantly enough, consider copying your file and making a new one so you can keep a history of all of your scripts.
See the Links page for many useful links related to Python Turtle, RGB Color, Color Theory, etc.