Python turtle animation project


Immediately after the collaboration statement, include comments that outline a short description of your program. Say what the turtles represent and what their choreography represents. You may want to write your description after you finish your code.


# This program shows two planets, one of them with a moon, orbiting a star.

# One of the planets orbits in retrograde motion. Because of a peculiarity of

# turtle celestial mechanics, the planets orbits are octagons, rather than

# ellipses. One of the planets has a moon. The innermost planet has a year half

# the length of the outer planet. The synthesizer music plays for an entire # year of the outermost planet, and restarts every time the planet passes its  # starting point.


Function Name: animateTurtles

Parameters: None

Return: A turtle world that meets the assignment’s requirements.

Test Case(s):

>>> setMediaPath()    # set media path to folder containing all media sources >>> animateTurtles()

Description: In this homework, you will use your knowledge of turtles, general programming, and creativity to finish off the semester with some dazzle. We are giving you a lot of choices and freedom of interpretation for this assignment. Have fun! Your assignment is to program some turtle choreography. The turtles should “dance” or move in a coordinated way relative to each other and to an accompaniment of music or appropriate sounds. Don’t forget to upload all the sound and image files you reference in your code. You may assume the TAs will download all the image and sounds files you uploaded and set their media path before testing your code.

In your assignment, you need to write a function that creates a turtle world that meets

ALL of the following minimum requirements:

  1. The turtle world must be at least 300 x 300.
  2. There must be at least five turtles.
  3. A picture must be dropped on the screen.
  4. You must set at least two turtles’ body color, shell color, size, pen size, and pen color.  5. Create motion! You don’t want to just move the turtles with forward. You want the turtles to move at a speed that the viewer can perceive as motion. The sleep method from the time module should be imported and can be used to give the sense of motion.
  5. At least 2 turtles must be moving at all times.
  6. Animation duration: The turtle choreography must last at least ten seconds and no longer than 30 seconds. The turtles must move consistently (in other words, you can’t just have the 6 turtles sit in place for 10 seconds).
  7. At some point in the animation, all five (or more) turtles should be moving in unison.
  8. You must incorporate a recursive function into your code.
  9. An unmodified sound must be played
  10. A manipulated version of the first sound must be played


  1. Plan what you want your animation to do ahead of time, before you write any code! This will help you when writing your code, but will also make it easier for TAs, instructors, etc. to help you f you get stuck. We suggest you write an outline of what you want to happen during your animation.
  2. We recommend you break your animation into helper functions. This will make your code more manageable (easier to read, debug, and alter). You can have as many additional functions as your want.
  3. You have to use at least one recursive function in your code. If you are familiar with them, feel free to use multiple recursive calls on object ­oriented features such as classes, subclasses, and overridden methods to organize your program as well.  4. DO NOT copy large segments of code that have been uploaded to the T Square forums or resources, especially if you do not fully understand the code. While such code may be useful for understanding, none of the examples are close enough to this open ended assignment to be a good starting point.
  4. Consider incorporating randomness into your animation to add an element of surprise.  6. If you want to change the world’s background, use the following trick: Create a picture at least as large as the world. Move a turtle to x=0, y=0 in the world. Have the turtle drop the picture.
  5. You can create a tiled world by dropping smaller pictures at the location corresponding to the top left corner of each tile.
  6. Do not use sound files that play past the end of the animation. There are several methods available through free software (such as Audacity) to cut audio files or convert them to useable file types. You may use copyright sounds for educational use, but please do not distribute your sounds outside the class if your sounds are copyright.  9. To synchronize sounds and actions, work out how long the sound is by counting its samples and finding its sampling rate. You can then use the sleep() method from the time module.

How We Will Grade:

  1. Download your program, sound, and image files to a single directory and setMediaPath to that directory. (Assume the media path will be set to a folder containing your .py file and all other files uploaded in your homework submission).
  2. Run program.
  3. Read your explanation, and observe the running program.
    1. a) Does the program meet the requirements above?
    2. b) Do the explanation and program behavior agree?
    3. c) Does the program load and run to completion without problems?
    4. d) Are the turtles choreographed appropriately?


  1. e) Creativity and imagination.