From: kirby u. <kir...@gm...> - 2012-08-26 19:10:59
|
On Sun, Aug 26, 2012 at 11:48 AM, M Hartman <air...@ho...> wrote: > That's what I'm using is PyCharm and it seems to be so much better than > Eclipse/PyDev, at least for a beginner. Anyway, is that the whole library in > /Lib/site-packages/visual? Does it install anything somewhere else? Also, I > see the visual directory but for some reason, I cannot import anything from > this directory, as I get errors in PyCharms built-in console. This is the > particular error: > > Traceback (most recent call last): > File "C:/Users/airspoon/PycharmProjects/goo/vis.py", line 1, in <module> > from visual import * > File "C:\Python32\lib\site-packages\visual\__init__.py", line 1, in > <module> > from .visual_all import * > File "C:\Python32\lib\site-packages\visual\visual_all.py", line 1, in > <module> > from vis import version > File "C:\Users\airspoon\PycharmProjects\goo\vis.py", line 3, in <module> > floor = Box (pos=(0,0,0), length=4, height=0.5, width=4, > color=color.blue) > NameError: name 'Box' is not defined > > > This is what I get when I copy and paste the 'bouncing ball' example from > the vPython website. Isn't that telling me that it can't import anything > from the visual library? > > Thanks for the help > In my version of bounce.py, Box is lowercase: from visual import * floor = box(length=4, height=0.5, width=4, color=color.blue) ball = sphere(pos=(0,4,0), 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 < 1: ball.velocity.y = -ball.velocity.y else: ball.velocity.y = ball.velocity.y - 9.8*dt There is not Box I don't think: >>> from visual import Box Traceback (most recent call last): File "<pyshell#0>", line 1 from visual import Box ImportError: cannot import name Box Kirby |