I am trying to use vpython, any way I can, but I'm failing...
About a month ago, I had already installed the Anaconda Python 2.7.10 on Win 8.1.
Today, I installed Vpython by typing into the command line: conda install -c https://conda.binstar.org/mwcraig vpython
Then I tried 3 things:
(1) Double-click the "VIDLE for VPython" shortcut on my desktop. Nothing happens. I look at the target, which points to pythonw.exe. I double-click directly on pythonw.exe. Nothing happens.
(2) I notice that there is also python.exe in the same folder, so I double-click on it, and get a command prompt. I type "from visual import *" and it seems to execute without error. Then I type "sphere()" and opens up a gray window titled "vpython" but it just hangs without ever showing me a sphere.
(3) Then I launched spyder, and typed "from visual import *", which seemed to execute without error. Then I typed sphere(), and it spits out the text "visual_common.primitives.sphere at 0x152ccb38" and another gray window pops up with the title "vpython" but it also hangs indefinitely.
[Note I already searched the forum and found & implemented M Craig's instructions to change the preferences->console->advanced settings->python interpreter to pythonw.exe
but it hasn't solved my problem. Furthermore, this interpreter setting seems to reset to python.exe every time I close & relaunch Spyder.]
How can I debug this situation? Thanks so much! I'd really like to show a simple vpython script in my physics lecture tomorrow...
--
You received this message because you are subscribed to the Google Groups "VPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vpython-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I'll make some time to look into this later today, but in the short run if go with Doug's suggestion to use glowscript.
Matt
from visual import *
ball = sphere(pos=(-5,0,0), radius=0.05, color=color.cyan)
wallR = box(pos=(6,0,0), size=(0.2,12,12), color=color.green)
wallL = box(pos=(-6,0,0), size=(0.2,12,12), color=color.green)
wallT = box(pos=(0,6,0), size=(12,0.2,12), color=color.blue)
wallB = box(pos=(0,-6,0), size=(12,0.2,12), color=color.blue)
wallBG = box(pos=(0,0,-6), size=(12,12,0.2), color=color.red)
wallFG = box(pos=(0,0,6), size=(12,12,0.2), color=color.red, opacity=0)
ball.velocity = vector(25,5,15)
ball.trail = curve(color=ball.color)
vscale = 0.05 #scales vector
cor = 1 #reflection coefficient
varr = arrow(pos=ball.pos, axis=vscale*ball.velocity, color=color.yellow)
deltat = 0.005
t = 0
scene.autoscale = False
while t < 90:
rate(100) # limits the number of times loop can execute per minute
if (ball.pos.x+ball.radius) > (wallR.pos.x-wallR.size.x):
ball.velocity.x = -cor*ball.velocity.x
if (ball.pos.x-ball.radius) < (wallL.pos.x+wallL.size.x):
ball.velocity.x = -cor*ball.velocity.x
if (ball.pos.y+ball.radius) > (wallT.pos.y-wallT.size.y):
ball.velocity.y = -cor*ball.velocity.y
if (ball.pos.y-ball.radius) < (wallB.pos.y+wallB.size.y):
ball.velocity.y = -cor*ball.velocity.y
if (ball.pos.z+ball.radius) > (wallFG.pos.z-wallFG.size.z):
ball.velocity.z = -cor*ball.velocity.z
if (ball.pos.z-ball.radius) < (wallBG.pos.z+wallBG.size.z):
ball.velocity.z = -cor*ball.velocity.z
ball.pos = ball.pos + ball.velocity*deltat
ball.trail.append(pos=ball.pos)
varr.pos = ball.pos
varr.axis = vscale*ball.velocity
t = t + deltat