You should save your programs for this assignment in your
cs21/homework/03 directory. A skeleton version of each
program will appear in this directory when you run update21
in a terminal window. The program handin21 will only submit
files in this directory.
Drawing a face
Open the file drawFace.py and create a program that draws a
face using the graphics library. Here are some guidelines to
Your program should keep the drawn face on the graphics window until
the user clicks the mouse. Then the graphics window should close and
your program should end.
Use color and several different types of shapes.
For symmetrical features (such as eyes or ears), remember to use the
clone method to make a copy of the original shape. Then
draw the cloned shape in the window and move it to
the desired location.
You may want to use the setCoords method of the
GraphWin object to adjust the coordinates of the window. You
can read about this method on page 152 of the textbook.
Be creative! For inspiration, here are two example faces from previous
cs21 students Madeleine Abromowitz and Jonathan Stafstrom.
Drawing a house with mouse clicks
Open the file drawHouse.py
and create a program that draws a
house with 5 (or more) mouse clicks as described in programming exercise 11 on
pages 161-2 in the textbook. Be sure to include a Text
at the bottom of the graphics window where you can explain each step
to the user of your program.
Below is an example of the output that might be produced by this
program. Feel free to choose your own color scheme. Once you satisfy
the requirements of problem, you may ask the user for additional mouse
clicks to add other features such as a chimney, a tree in the front
yard, a sun, or even more elaborate things like a fire spewing dragon.
Now go back to either of the previous programs and add some sort of
animation. For example, you could make the entire face move around
the window, you could have one feature of the face move (such as a
blinking eye), or you could add animated aspects to your house scene.
Once you are satisfied with your programs, hand them in by typing
handin21 in a terminal window.