From: kirby u. <kir...@gm...> - 2010-11-13 05:38:03
|
I installed the latest Visual Python 5 on a Win7 laptop a couple days ago. Everything is working great. I used the binary. However, it put Fonttools in a folder under another Foottools folder I'm pretty sure. I had to diagnose that problem manually. Apologies if the glitch was on my end. Below is one of the programs I used in my Martian Math class this summer. I used it as scaffolding, with students tweaking it to listen for more colors. Kirby Urner Portland, OR from visual import * def setscene ( ): """set the stage for our little drama""" scene2 = display(title='Pipedream 2', fullscreen= True, autoscale = True, background=color.white) return scene2 def pipedream( n ): delta_x = 0.1 # move to the right by this little amount right_limit = 30 # at this rightmost limit, remove the shape from the list scene = setscene() scene.select() leftpipe = cylinder(pos = (-35,0,0), axis = (5,0,0), radius = 1.5, color = color.green) rightpipe = cylinder(pos = (35,0,0), axis = (-5,0,0), radius = 1.5, color = color.green) theshapes = [ ] # a list of all active shapes spacer = 5 # counts down to put space between shape creation events thecolor = color.red # default color while True: "color picker -- add more options?" if scene.kb.keys: # event waiting to be processed? s = scene.kb.getkey() # get keyboard info if s in ['b' , 'B']: thecolor = color.blue if s in ['r', 'R']: thecolor = color.red if s in ['o', 'O']: thecolor = color.orange if len (theshapes ) < n and spacer <= 0: theshapes.insert (0, pickone( thecolor ) ) spacer = 5 for shape in theshapes: if shape.x > right_limit: shape.visible = False del shape theshapes.pop( ) # drop off the list else: shape.x = shape.x + delta_x # shift to the right spacer = spacer - delta_x rate(50) def pickone( c ): return sphere( pos = (-30,0,0), radius = 1, color = c) if __name__ == '__main__': pipedream( 11 ) |