Independent window vpython application

1,011 views
Skip to first unread message

amedec...@gmail.com

unread,
Jul 2, 2018, 5:10:45 AM7/2/18
to VPython-users
Hi,

I have been using vpython to develop 3D visualization models about 15 years ago. I wanted to use them again recently but it seems now that you cannot use Vpython scripts outside of a jupyter notebook. The thing is, I don't want to use a browser to work and I have no intention to develop web apps. I use Vpython for education mainly. My question is : is it still possible to run Vpython scripts without using Jupyter (just in a dedicated window like before) ? I am working with OSX, and Anaconda for python 2.7 and 3.6. Thanks for your help :)

AC

Aaron Titus

unread,
Jul 2, 2018, 8:52:25 AM7/2/18
to vpytho...@googlegroups.com
When you say "I don't want to use a browser to work..." are you referring to writing code or viewing 3D graphics?

You can write code in any text editor. You don't have to use Jupyter.

The newest version of VPython uses WebGL; therefore, viewing the 3D graphics requires a browser. The browser tab that is opened is essentially your "dedicated window."

If you want to use VPython classic, I suggest setting up a conda environment for Python 2.7. Then install it in the environment using:

conda install -c mwcraig vpython

You will be able to run vidle from the command line if you wish. (>> vidle)

Also, you can run your vpython programs from the command line using:

 >> python programname.py

You should see a VPython window open.

Aaron


--
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-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

amedec...@gmail.com

unread,
Jul 2, 2018, 10:30:58 AM7/2/18
to VPython-users
Thank you very Much Aaron :)

No I use TextMate and XCode to edit/compile ... When I use the command python progname.py in a terminal and that this script requires the use of VPython (like the attached file) a browser window is automatically open in which the script runs. What I would like to do is to have just a single window (maybe it was a VIDLE window) like this :


to appear instead of this annoying (to me) mandatory new tab in my browser :)

Thank you in advance.

AC
To unsubscribe from this group and stop receiving emails from it, send an email to vpython-user...@googlegroups.com.
Bounce.py
Auto Generated Inline Image 1

amedec...@gmail.com

unread,
Jul 2, 2018, 10:42:11 AM7/2/18
to VPython-users
I am going to try you suggestion and let you know.

AC.
---

Le lundi 2 juillet 2018 14:52:25 UTC+2, Aaron Titus a écrit :
To unsubscribe from this group and stop receiving emails from it, send an email to vpython-user...@googlegroups.com.

amedec...@gmail.com

unread,
Jul 2, 2018, 10:47:18 AM7/2/18
to VPython-users
I tried the command but obtained :



$ conda install
-c mwcraig vpython
Solving environment: failed

UnsatisfiableError: The following specifications were found to be in conflict:
 
- blaze
 
- vpython
Use "conda info <package>" to see the dependencies for each package.

Sorry I am not familiar enough with conda subtilities to solve this. Any idea ? :)

AC


Le lundi 2 juillet 2018 14:52:25 UTC+2, Aaron Titus a écrit :
To unsubscribe from this group and stop receiving emails from it, send an email to vpython-user...@googlegroups.com.

John

unread,
Jul 2, 2018, 12:13:48 PM7/2/18
to VPython-users
Did you follow the Aaron's suggestion to "If you want to use VPython classic, I suggest setting up a conda environment for Python 2.7."

type the command 

conda info -e

to list the conda environments on your computer. A conda environment is a sandbox into which you can install the python packages that you are interested in using. Vpython does not use blaze so  to create an environment with the name "py27" for python 2.7 which contains just the classic vpython package and its dependencies you can do the following.

conda create -n py27  python=2.7

Then once this installs, follow the instructions to activate the environment. e.g. for Windows machine use the command

activate py27

Then install vpython in this environment as per Aaron's instructions.

conda install -c mwcraig vpython

You can also install any other python packages that you might need for this conda environment.

conda install packagename

Then you can use the built in python editor "idle" to create and run classic vpython programs.

I haven't used TextMate or XCode so I don't know how to configure them to use this environment to compile vpython code.

When you are finished using this py27 conda environment you can exit it with the command.

deactivate

Just remember to activate the environment again when you wish to run vpython.

amedec...@gmail.com

unread,
Jul 2, 2018, 1:10:02 PM7/2/18
to VPython-users


Le lundi 2 juillet 2018 18:13:48 UTC+2, John a écrit :
Did you follow the Aaron's suggestion to "If you want to use VPython classic, I suggest setting up a conda environment for Python 2.7."

type the command 

conda info -e

Did it

to list the conda environments on your computer. A conda environment is a sandbox into which you can install the python packages that you are interested in using.
OK I have already python2.7 and 3.6 as tow separated sandbox between witch I switch when needed

Vpython does not use blaze so  to create an environment with the name "py27" for python 2.7 which contains just the classic vpython package and its dependencies you can do the following.

conda create -n py27  python=2.7
OK

Then once this installs, follow the instructions to activate the environment. e.g. for Windows machine use the command

activate py27
OK (source activate py27 for osx)

Then install vpython in this environment as per Aaron's instructions.

conda install -c mwcraig vpython

OK
You can also install any other python packages that you might need for this conda environment.

conda install packagename

Then you can use the built in python editor "idle" to create and run classic vpython programs.
OK

I haven't used TextMate or XCode so I don't know how to configure them to use this environment to compile vpython code.

When you are finished using this py27 conda environment you can exit it with the command.

deactivate

Just remember to activate the environment again when you wish to run vpython.


Thank you, I have done all these very steps carefully and with or w/o idle no new window appear. It might be a problem related to osx.

I am going to use the Jupyter version then. Thank you for your help :)

John

unread,
Jul 2, 2018, 1:51:28 PM7/2/18
to VPython-users
For classic vpython I think you need to user VIDLE instead of IDLE, but I don't know how to install VIDLE into the conda environment py27. Maybe someone else knows if it is installed as part of 

conda install -c mwcraig vpython

and if it isn't how to install it or launch it .

Be aware that the vpython syntax is different between "classic VPython" and the new VPython 7. For classic VPython you import vpython with the command

from visual import *

For the new VPython 7 used by Jupyter notebook you import vpython with the command.

from vpython import *

There are also some differences in vpython syntax between the two.

John

Bruce Sherwood

unread,
Jul 2, 2018, 4:24:37 PM7/2/18
to VPython-users
Two additional comments:

1) Be aware the although Classic VPython (VPython 6) is still available, it is no longer supported, as of January  2016. Here is the rationale for that decision:


2) Using VPython 7 with installed Python does not have to be done in a Jupyter notebook. It can be used in other programming environments, as is explained at vpython.org.

Bruce

amedec...@gmail.com

unread,
Jul 3, 2018, 3:20:57 AM7/3/18
to VPython-users
Thank you John. I was indeed a little bit confusing this switch between vpython and visual. I didn't know that VIDLE was necessary but you must be true.

AC.

amedec...@gmail.com

unread,
Jul 3, 2018, 3:22:59 AM7/3/18
to VPython-users
Thank you Bruce but I have changed my mind. As I mentioned previously, it is a pain in the backside to try to use the oldschool version of Vpython with VIDLE ... and, halas, I will use the browsered version ;-)

Have a nice day,

AC.
Reply all
Reply to author
Forward
0 new messages