from cs1graphics import * numLevels = 8 # number of levels unitSize = 12 # the height of one level screenSize = unitSize * (numLevels + 1) paper = Canvas(screenSize, screenSize) small = unitSize/2 # minimal padding big = screenSize-unitSize/2 # screensize - padding poly = Polygon(Point(small,big), Point(big,big)) # bottom edge points poly.setFillColor('gray') # add two points for each level for level in range(numLevels): x = big - level*unitSize # x for rightmost of two points at this level y = (0.5+level) * unitSize poly.addPoint(Point(x, y)) poly.addPoint(Point(x-unitSize, y)) paper.add(poly)