""" demo.py a little graphics demo ................. (8,60) top right . . | 20 . | | | | | 10 . 0 1 2 3 4 .. 7 8 0 ................... -10 (-1,-10) lower left Jim Mahoney | March 8 2021 """ from graphics import * def main(): # make up some numbers to put on a bar graph numbers = [10, 20, 4, 17, 30, 50, 18] window = GraphWin("a little demonstration", 800, 800) window.setCoords(-1, -10, 8, 60) boundary = Rectangle( Point(0,0), Point(7.5, 55) ) boundary.setOutline('grey') boundary.setWidth(3) boundary.draw(window) position = 0 # where rectangle is horizontally for number in numbers: p1 = Point(position, 0) # bottom left of rectangle p2 = Point(position+1, number) rect = Rectangle(p1, p2) rect.setFill('green') rect.draw(window) position = position + 1 # next rectangle is over a bit wait = input("Done? ") main()