# Bruce Maxwell # originally written in fall 2012 # lab 5 for spring 2013 # import time import graphics as gr import multi_shape as ms def main(): """ creates a scene with several animated steam plants""" # create a window win = gr.GraphWin( 'Steam Plants', 600, 600 ) # create three steam plants sp1 = ms.steam_init( 100, 500, 2.0 ) sp2 = ms.steam_init( 300, 200, 0.4 ) sp3 = ms.steam_init( 400, 300, 1.0 ) # put all the steam plant objects in a list steamplants = [sp1, sp2, sp3] # draw all the steam plants for plant in steamplants: ms.draw( plant, win ) # loop until the user clicks t = 0 while True: time.sleep(0.25) # loop over the steam plant objects and animate them for plant in steamplants: ms.steam_animate( plant, t, win ) # increment the frame counter t += 1 # check for a mouse event and break if it occurs if win.checkMouse(): break # close the window win.close() if __name__ == "__main__": main()