CS21 Lab3: Graphics

Due 11:59pm Tuesday, February 12, 2008

A skeleton version of each program will appear when you run update21 in a terminal window. The program handin21 will only submit files in this directory.

1. 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 follow:

Be creative! For inspiration, here are two example faces from previous cs21 students Madeleine Abromowitz and Jonathan Stafstrom.
2. Drawing a house with mouse clicks
Open the file drawHouse.py and create a program that draws a house with 5 mouse clicks as follows:

  1. The first two clicks will indicate the opposite corners of the rectangular frame of the house. The first click should be the lower left corner and the second click should be the upper right corner.
  2. The third click will indicate the center of the top edge of a rectangular door. The door should have a total width that is one fifth of the width of the house frame. The sides of the door should extend down to the bottom of the house frame.
  3. The fourth click will indicate the center of a square window. The window should be half as wide as the door.
  4. The fifth click will indicate the peak of the roof. The edges of the roof will extend from the point at the peak to the corners of the top edge of the house frame.
Be sure to include a Text box 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 have completed the above requirements, add one of the following animated features to the scene: a cloud that drifts across the sky, a sun that rises or sets, or an animal or person that moves.


Once you are satisfied with your programs, hand them in by typing handin21 in a terminal window.