As you have proposed, I modified the first line to: from visual import box, sphere, color, vector, rate This lead to a clean script without any spyder warning and a successful run, and only ONE. When I tried to rerun the script by pressing F5, nothing happen. My conclusion is maybe spyder isn't friendly enought to some modules, such as Vpython.
在 2012年7月25日星期三UTC+8上午11时36分54秒,David写道: > > The message you reported is just a warning, you can ignore it if you want. > Did you actually try running the script? > > The reason for the warning is the line "from visual import *", which > imports a whole bunch of things from the library, which spyder doesn't know > about. This means that spyder's code cannot do clever things like detecting > whether you have called an undefined function and displaying a warning > about it in the editor. > > On Tuesday, 24 July 2012 15:26:34 UTC+10, 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/-/3JCmBhxH5mYJ. 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.
