Turtle Graphics Shapes

posted by: Ms. Martin 7 February 2011 No Comment

Writing programs is perfect for generating regular shapes for a cool logo or something of the sort.  These exercises will help you gain spacial reasoning skills while letting you be a little creative.  Check out what students came up with last semester.  Make sure you write each shape in its own function so you can reuse it!  Be sure to play with color, pen thickness, positioning and so on. These should all be in a file called shapes.py.

Note for Tuesday: we don’t know how to make things scalable, yet.  We’ll learn that on the long period day but for now, you can still do the shapes and leave the scaling for later.

Activity 1: scalable square pinwheel

The best place to start for these problems is to decompose the shape.  What’s it made of?  How would you describe it to somebody? Start by making it with 40 spokes, and then make that a value the user can set.  Hint: you’ll want to reuse your draw_square() function from earlier.

Activity 2: scalable star

Can you fill one like I am showing to the left?  Can you change its color?  What cool star patterns can you create?  (Hint: the angle for a point is 144 degrees)

Activity 3: scalable sunburst

The user should be able to decide how many spokes it has and what color it should be when calling your function.

Notice that I called the hideturtle() function to make the little triangle disappear.

Activity 4: letter

Write a function that writes out the first letter of your name in a block font.  Decorate it using your previous functions and lots of color!  Here’s a good example:

Activity 5: programmer’s choice

Come up with some interesting repetitive shape to draw!  Here are some ideas:

1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 2.33 out of 5)
Loading ... Loading ...

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>