VPython weird action

52 views
Skip to first unread message

Milad K

unread,
Apr 28, 2016, 4:24:17 AM4/28/16
to VPython-users
Hi, I install vpython on OSX OS, but when I run
from visual import *

, it shows the python idle wants to open, but it doesn't just blinking and cursor spinning, then meanwhile I call
sphere()

, then it opens the ide with blank page and again spinning cursor.

Anaconda distributation.
I installed it in this way: 
conda install -c https://conda.binstar.org/mwcraig vpython

Steve Spicklemire

unread,
Apr 28, 2016, 4:50:25 AM4/28/16
to vpytho...@googlegroups.com, Steve Spicklemire
Hi Milad,

You’re somehow mixing different vpython versions. There is a description of the evolution of vpython here:

<http://vpython.org/contents/announcements/evolution.html>

----------------

The “visual” module that you’re importing is part of “classic” vpython with documentation here:

<http://vpython.org/contents/doc.html>

and features described here:

<http://vpython.org/contents/new_features.html>

The last version of classic vpython was vpython 6. Due to the way the screen is updated in vpython 6 you need a ‘rate()’ in an update loop to see the screen actually change/update as your program runs. So a minimal working program with a sphere might look like this:

sphere()

while True:
rate(30)


This should produce a window with a sphere that you can interact with using the mouse.

The vpython 6 installer also installs VIDLE so you can edit programs and run them easily.

----------------

The ‘vpython’ module is a new and pretty different direction for vpython. It shares most syntax/concepts with classic vpython but the implementation is completely changed. It uses WebGL to render 3D objects in a web browser. It uses the “jupyter” programming environment in a browser to control the 3D scene. You can’t program the new vpython module to create a stand-alone application separate from a web browser as you’re evidently attempting to do.

You can learn about jupyter here: <http://jupyter.org/>

The documentation for this new module can be found here:

<http://vpython.org/index.html>

After the paragraph regarding glowscript, find the header that says: "Experienced Python / VPython user? Try Jupyter VPython (this is a new version under rapid development, but already quite capable)”

I hope that helps!

-steve
> --
> 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.

Steve Spicklemire

unread,
Apr 28, 2016, 4:55:22 AM4/28/16
to vpytho...@googlegroups.com, Steve Spicklemire
Hi Milad,

Of course I left out the “from visual import *”!

So

----
from visual import *

sphere()

while True:
rate(30)
----

Alternatively you can test your install using:

python -c 'import visual; visual.sphere()’

Since at the end of the program visual adds an ‘implied loop’ like the one above.

-steve

Milad K

unread,
Apr 28, 2016, 2:43:22 PM4/28/16
to VPython-users, stevespi...@gmail.com
Hi Steve,

Thank you for your complete and perfect answer. Yes it worked after I added the rate(), I'm searching around for packages which represent the 3D geometry. 

I'll do some search for Jupyter.

Milad
Reply all
Reply to author
Forward
0 new messages