Exam 1: Wednesday, Feb 20
You will get a study guide. You will also get a one-page Python summary
that will also be available to you during the exam.
Homework 4, due Monday, Feb 18
You are to submit one file containing the functions
necessary for the following:
Monday:
graphics.py
installing it: install it in a system directory, or in the same folder as your project.
using it
Features:
Actions:
from graphics import *
from graphics import *
def draw1():
w = GraphWin("my window", 400, 400)
center=Point(200,200)
circle=Circle(center, 100)
circle.draw(w)
circle.setFill("cyan")
# other colors too: "red", "red3", "purple",
"green4", "cyan2", "magenta"
# Is there a "cerulean"?
rect = Rectangle(Point(100, 50), Point(300, 150))
rect.draw(w)
rect2 = rect.clone()
rect2.move(0, 200) #
which way does it move?
rect2.draw(w)
hi = Text(Point(200, 100), "hello there")
hi.draw(w)
lefteyept = center.clone()
lefteyept.move(-50, -20)
lefteye = Circle(lefteyept, 10)
lefteye.draw(w)
righteyept = center.clone()
righteyept.move(-50, +20)
righteye = Circle(righteyept, 10)
righteye.draw(w)
tr1 = Polygon(Point(100,100), Point(100, 150),
Point(150,150))
tr1.draw(w)
tr1.setFill("purple")
plist = []
plist.append(Point(160, 300))
plist.append(Point(240, 300))
plist.append(Point(240, 340))
plist.append(Point(280, 340))
plist.append(Point(280, 380))
plist.append(Point(200, 380))
plist.append(Point(200, 340))
plist.append(Point(160, 340))
poly = Polygon(plist)
poly.draw(w)
poly.setFill("magenta")
plist = []
plist.append(Point(0, 0))
plist.append(Point(80, 0))
plist.append(Point(80, 40))
plist.append(Point(120, 40))
plist.append(Point(120, 60))
plist.append(Point(40, 60))
plist.append(Point(40, 20))
plist.append(Point(0, 20))
poly2 = Polygon(plist)
poly2.move(40, 320)
poly2.setFill("cyan3");
poly2.draw(w)
draw1()
Wednesday:
triangles, polygons