Computer Science 110
Foundations of Computing through Digital Media

Denison

CS 110 Homework 02

Due: By class time Thursday, February 2

In Homework 2 you will practice graphics and lots of function invocation in Python.

Step 1: Sketching a picture

As your first step for Homework 02, you should draw on a sheet of paper a picture of your choosing. The picture must consist of any combination of lines, rectangles, circles, ovals, text, but should be made entirely by hand (i.e., not made by a computer program). The picture should have at least twenty of the above shapes (though more is always better), using at least one of each of the base objects in the graphics library. It will help to have some notion of the scale, in pixels, of the overall picture, and of the objects that you are placing withing the picture. Target a canvas size of around 640 by 480.

Here are some examples made by earlier students in this course:

Step 2: Rendering the picture

You should practice familiarity with graphical objects in Python by drawing your hand-drawn paper using graphical objects in Python. Put your picture in a file called Picture.py. To repeat a collection of objects on different parts of the screen, think of how you might do this using functions, with parameters to govern where on the canvas a repeatable set of steps should be placed.

Refer to the following link (or to your handout) to see how to use the different graphical objects availble to you: http://mcsp.wartburg.edu/zelle/python/graphics/graphics/.

Get a screen capture of your picture using the Grab utility (you can find this under Applications -> Utilities) and save it as tiff file.

Step 3: Back to the guessing game

If you did not revise your guessing game for homework 01 to improve it, I want you to do that as a required part of this homework. If you already did a revision, think about and implement some further improvement. Name your program BetterGuess.py.

Submitting your lab

Make sure that all your work for this lab is in a folder called hw02. Copy this folder into your personal folder on the shared drives by the deadline (class time, February 2nd).

Please make sure that your hw02 directory has the following files: