'''building.py -- a class to represent a graphical building Jeff Ondich and friends, 10/5/07 Objects of the Building class are used to draw 2D graphical buildings using John Zelle's graphics library. This is just the beginning of a class, as we started to develop it in class on 10/5/07. ''' from graphics import * class Building: def __init__(self, width, height, left): self.width = width self.height = height self.left = left def getWidth(self): return self.width def setWidth(self, width): self.width = width # more accessors... def draw(self, window): upperLeft = Point(self.left, 0) bottomRight = Point(self.left + self.width, self.height) r = Rectangle(upperLeft, bottomRight) r.draw(window) # Code for testing the class. if __name__ == '__main__': win = GraphWin('Building test', 600, 400) b = Building(100, 300, 150) b.draw(win) s = raw_input('Hit Enter to quit')