VPython running in a Jupyter notebook
Latest commit af46c8a Nov 15, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
CythonBuild Delete cyvector.c and cyvector.pyx from CythonBuild; they are built f… Dec 4, 2017
Demos Add individual async demos Oct 16, 2018
Demos_no_notebook Add time import to stonehenge demos Oct 13, 2018
labextension/vpython Update glowcommlab.js for winput Nov 7, 2018
vpython.recipe Restrict ipykernel version Oct 7, 2018
vpython Add string error check to capture() Nov 15, 2018
.gitattributes Use versioneer for version numbering Jun 21, 2016
.gitignore Added ignoring .c and .pyd Dec 4, 2017
.travis.yml Fix py.test call on travis Oct 13, 2018
CHANGES.txt preparing for reorg of repo Jan 22, 2016
JupyterPythonDemos.zip Add async demos required by Jupyter lab Oct 16, 2018
LICENSE.txt preparing for reorg of repo Jan 22, 2016
MANIFEST.in Add Cython source to manifest Jul 12, 2016
README.md Point binder at master instead of a release Aug 9, 2018
VPythonDemos_no_notebook.zip Update demo programs Sep 5, 2018
appveyor.yml Use Python 3.6 for the 3.4 builds on windows Nov 4, 2017
convert_stl.zip Provide a converter of 3D STL models to triangles May 8, 2018
ez_setup.py add ez_setup to setup.py Jan 23, 2016
index.ipynb Added two more Jupyter notebook demo files Mar 3, 2018
requirements.txt Add Cython to dependencies for binder Aug 9, 2018
setup.cfg Fix versioneer configuration Aug 18, 2016
setup.py Restrict ipykernel version Oct 7, 2018
versioneer.py Use versioneer for version numbering Jun 21, 2016
vp_copy.yaml Add list of channels to copy from conda-forge May 20, 2017

README.md

VPython

This package enables one to run VPython in a browser, using the GlowScript VPython API, documented in the Help at http://glowscript.org. If the code is in a cell in a Jupyter notebook, the 3D scene appears in the Jupyter notebook. If the code is launched outside a notebook (e.g. from the command line), a browser window will open displaying the scene.

VPython makes it unusually easy to create navigable real-time 3D animations. The one-line program "sphere()" produces a 3D sphere with appropriate lighting and with the camera positioned so that the scene fills the view. It also activates mouse interactions to zoom and rotate the camera view. This implementation of VPython was begun by John Coady in May 2014. Ruth Chabay and Bruce Sherwood are assisting in its further development. The repository for the source code is at https://github.com/BruceSherwood/vpython-jupyter.

Installation

For more detailed instructions on how to install vpython, see http://vpython.org, where you will also find a link to the VPython forum, which is the preferred place to report issues and to request assistance.

Briefly:

  • If you use the anaconda python distribution, install like this: conda install -c vpython vpython
  • If you use any other python distribution, install this way: pip install vpython

Sample program

Here is a simple example:

from vpython import *
sphere()

This will create a canvas containing a 3D sphere, with mouse and touch controls available to zoom and rotate the camera:

Right button drag or Ctrl-drag to rotate "camera" to view scene.
To zoom, drag with middle button or Alt/Option depressed, or use scroll wheel.
     On a two-button mouse, middle is left + right.
Shift-drag to pan left/right and up/down.
Touch screen: pinch/extend to zoom, swipe or two-finger rotate.

Currently, to re-run a VPython program you need to click the circular arrow icon to "restart the kernel" and then click the red-highlighted button, then click in the first cell, then click the run icon. Alternatively, if you insert "scene = canvas()" at the start of your program, you can rerun the program without restarting the kernel.

Run example VPython programs: Binder

vpython build status (for the vpython developers)

Build Status Build status