CS 206 Data Structures
Spring 2010

Assignment#2 (Using Python Modules & Modeling Graphics Objects)
Due on Tuesday, February 2, 2009.

In this assignment you will use the Zelle graphics module to do one of the following:

Design and Draw an object of your chosing (a snowman, a self-portrait, a logo, a pattern, an animal, a plant, a vehicle, a thing, a monster, a new geometric shape, etc.)

The goal of this exercise is to being using the ideas behind modeling objects. You will define a function, say for a snowman, as below:

def snowman(anchorPoint, height):
'''Draws a snowman anchored at anchorPoint and of the given height.'''
...

The idea is that, like the objects in the graphics library, you should be able to create the object at any place in the graphics window. Moreover, it will use the specified parameters to scale the drawing object accordingly. Thus, you could create a big snowman, next to a little one using the commands:

snowman(p1, 200)
snowman(p2, 100)

where p1 and p2 are two points. Your program should allow you to draw any number of these objects in the graphics window. It will interactively input the size and the position from the user. The position, anchor point, should be determined using a mouse-click in the graphics window.

In designing your graphics object, be creative, but without spending too much time in the design. Make generous use of the graphics objects provided in the graphics library.

Hand in a printout of your program and one or more sample output screens from your program showing objects of different sizes in the same window.



Back to CS206 Spring 2010 Materials