rad=5e-3 # the radius of a point zoom_scale_step=math.pow(2.,1./20.) #scaling factor used for zooming in ####################### # #Now... WHEN AN OBJECT IS PICKED, #TRANSLATE THE scene.center TO THE OBJECT'S POSITION, AND ZOOM if scene.mouse.events: MOUSE_EVENT=scene.mouse.getevent() print MOUSE_EVENT.press, MOUSE_EVENT.pos if (MOUSE_EVENT.press=='left' or MOUSE_EVENT.press=='right' or MOUSE_EVENT.press=='middle'): if MOUSE_EVENT.press=='left': #ZOOM IN scale_factor=2. scale_step=zoom_scale_step elif MOUSE_EVENT.press=='right': #ZOOM OUT scale_factor=1./2. scale_step=1./zoom_scale_step else: #NO ZOOM scale_factor=1.0 scale_step=1.0 target=MOUSE_EVENT.pos step=(target-scene.center)/20. for i in arange(0,20): rate(50) scene.center +=step scene.scale *= scale_step #(zoom_scale_step**20.=2.0) rad /= scale_factor for o in scene.objects: o.radius = rad # #######################