''' city3.py Jeff Ondich, 10/23/09 Putting the Building class through some paces, round 3. ''' import sys import random from graphics import * from building import Building if len(sys.argv) != 2 or not sys.argv[1].isdigit(): print 'Usage: %s numberOfBuildings' % sys.argv[0] exit() cityWidth = 800 cityHeight = 500 window = GraphWin('City', cityWidth, cityHeight) # Lots of random buildings numberOfBuildings = int(sys.argv[1]) for k in range(numberOfBuildings): left = random.randint(-10, cityWidth) bottom = cityHeight - 10 width = random.randint(75, 250) height = random.randint(100, cityHeight - 20) color = color_rgb(random.randint(0, 255),random.randint(0, 255),random.randint(0, 255)) b = Building(left, bottom, width, height) b.setColor(color) b.draw(window) response = raw_input('Hit Enter to quit')