The script runs pretty well in IDLE, so I'm sure the problem came from spyder. Thanks for the hints
在 2012年7月24日星期二UTC+8下午4时25分08秒,anatoly techtonik写道: > > Is the problem that you can not run this script with Spyder? Have you > tried adding vpython libs to PYTHONPATH? Can you run it with plain Python > from command line? > > On Tuesday, July 24, 2012 8:26:34 AM UTC+3, pai wrote: >> >> I'm have installed Python(x,y)-2.7.2.3 on Win7 32-bit system to draw a >> simple 3D animation with vpython <http://www.vpython.org/> module. The >> script is shown as following, but the spyder complains with an exclamation >> mark at the first line of the script and hint shows that 'from visual >> import *' used; unable to detect undefined names. The script runs >> pretty well in IDLE, so I'm sure the problem came from spyder. Can anyone >> helps me, please ? >> >> >> >> from visual import * >> >> floor = box (pos=(0,0,0), length=4, height=0.5, width=4, color=color.blue) >> >> ball = sphere (pos=(0,4,0), radius=1, color=color.red) >> >> ball.velocity = vector(0,-1,0) >> >> dt = 0.01 >> >> while 1: >> >> rate (100) >> >> ball.pos = ball.pos + ball.velocity*dt >> >> if ball.y < ball.radius: >> >> ball.velocity.y = abs(ball.velocity.y) >> >> else: >> >> ball.velocity.y = ball.velocity.y - 9.8*dt >> > -- You received this message because you are subscribed to the Google Groups "spyder" group. To view this discussion on the web visit https://groups.google.com/d/msg/spyderlib/-/-EPgvE2OdSAJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/spyderlib?hl=en.
