#ChapterOO/Balloon0.py from graphics import * winW, winH = 500, 500 # window geometry class Balloon: def __init__( self, c, r ): # constructor: c = center point, radius self.bCircle = Circle( c, r ) def move( self, dx, dy ): self.bCircle.move( dx, dy ) def ddraw( self, win ): self.bCircle.draw( win ) def main(): win = GraphWin( "Demo0: 3 Balloons", winW, winH ) b1 = Balloon( Point(50,30), 20 ) b2 = Balloon(Point(170,100),30) b3 = Balloon(Point(250,200),35) blist=[b1,b2,b3] for b in blist: #draw objects b.bCircle.setFill("red") b.ddraw(win) if win.getMouse(): #move objects while True: b1.move( 0.1, 0 ) b2.move(0,0.1) main()