CS 161 The Art of Programming

Assignment 6: Graphics


Part I: Due 10:00am, Saturday 24 October

Part II: Due 10:00am, Saturday 31 October


This assignment is to be completed in teams of two. Partners will be assigned by your Lab TA. Only one copy of each assignment should be turned in. Include the names of both partners in the Comments box on the turn in page.


Follow the Programming Help link on the Blackboard course page for important information about programming graphics in Python.


Part I: Five-click house. You are to write a program that allows the user to draw simple house using five mouse clicks. The first two clicks will be the opposite corners of the rectangular frame of the house. The third click will indicate the center of the top edge of the rectangular door. The door should have a total width that is 1/5 the width of the house frame. The sides of the door should extend from the corners of the top down to the bottom of the frame. The fourth click will indicate the center of a square window. The window is half as wide as the door. The last 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. The objects in the drawing (house, door, window, roof) should be colored appropriately. A final sixth click should close the graphics window. Turn in your program as a file named house.pyw.



Part II: Animation. Create a graphical animation based on a scene from a popular movie or television show. The characters will be simple shapes: circles, rectangles, and polygons. They should express themselves by movement, color, changes in size, and text. Include a background: it may be a simple colored rectangle filling the back of the window, or an image from a GIF file. The story should be started by running your file named story.pyw. At your option, the story may require the user to click with the mouse a few times to advance the plot. The final click should close the graphics window. Before writing your program, write a draft script and sketch some storyboards of the key moments of the scene. Turn in your script as a file script.txt (or script.doc) and your program as a file story.pyw. Turn in your story board sketches to your Lab TA at the lab session following the turn-in date for the rest of the assignment.