Skip to main content

VPython for Jupyter Notebook

Project description

VPython

This package enables one to run VPython in a browser, using the GlowScript VPython API, documented in the Help at https://www.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, Matt Craig, and Bruce Sherwood are assisting in its further development.

Installation

For more detailed instructions on how to install vpython, see https://vpython.org, where you will also find a link to the VPython forum, which is a good 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 in a Jupyter notebook 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

Installation for developers from package source

You should install Cython (conda install cython or pip install cython) so that the fast version of the vector class can be generated and compiled. You may also need to install a compiler (command line tools on Mac, community edition on Visual Studio on Windows).

If you don't have a compilier vpython should still work, but code that generates a lot of vectors may run a little slower.

To install vpython from source run this command from the source directory after you have downloaded it:

pip install -e .

The -e option installs the code with symbolic links so that change you make show up without needing to reinstall.

If you also need the JupyterLab extension, please see the instructions in the labextension folder.

vpython build status (for the vpython developers)

Testing workfloww

Working with the source code

Here is an overview of the software architecture:

https://vpython.org/contents/VPythonArchitecture.pdf

The vpython module uses the GlowScript library (vpython/vpython_libraries/glow.min.js). The GlowScript repository is here:

https://github.com/vpython/glowscript

In the GlowScript repository's docs folder, GlowScriptOverview.txt provides more details on the GlowScript architecture.

Here is information on how to run GlowScript VPython locally, which makes possible testing changes to the GlowScript library:

https://www.glowscript.org/docs/GlowScriptDocs/local.html

If you execute build_original_no_overload.py, and change the statement "if True:" to "if False", you will generate into the ForInstalledPython folder an un-minified glow.min.js which can be copied to site-packages/vpython/vpython_libraries and tested by running your test in (say) idle or spyder. (Running in Jupyter notebook or Jupyterlab requires additional fiddling.)

Note that in site-packages/vpython/vpython_libraries it is glowcomm.html that is used by launchers such as idle or spyder; glowcomm.js is used with Jupyter notebook (and a modified version is used in Jupyterlab).

Placing console.log(....) statements in the GlowScript code or in the JavaScript section of glowcomm.html can be useful in debugging. You may also need to put debugging statements into site-packages/vpython/vpython.py.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vpython-7.6.3rc4.tar.gz (3.6 MB view details)

Uploaded Source

Built Distributions

vpython-7.6.3rc4-cp310-cp310-win_amd64.whl (3.6 MB view details)

Uploaded CPython 3.10Windows x86-64

vpython-7.6.3rc4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

vpython-7.6.3rc4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (3.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.12+ x86-64manylinux: glibc 2.5+ x86-64

vpython-7.6.3rc4-cp310-cp310-macosx_10_15_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.10macOS 10.15+ x86-64

vpython-7.6.3rc4-cp39-cp39-win_amd64.whl (3.6 MB view details)

Uploaded CPython 3.9Windows x86-64

vpython-7.6.3rc4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.8 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

vpython-7.6.3rc4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (3.7 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.12+ x86-64manylinux: glibc 2.5+ x86-64

vpython-7.6.3rc4-cp39-cp39-macosx_10_14_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.9macOS 10.14+ x86-64

vpython-7.6.3rc4-cp38-cp38-win_amd64.whl (3.6 MB view details)

Uploaded CPython 3.8Windows x86-64

vpython-7.6.3rc4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.8 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ ARM64

vpython-7.6.3rc4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (3.7 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.12+ x86-64manylinux: glibc 2.5+ x86-64

vpython-7.6.3rc4-cp38-cp38-macosx_10_14_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.8macOS 10.14+ x86-64

vpython-7.6.3rc4-cp37-cp37m-win_amd64.whl (3.6 MB view details)

Uploaded CPython 3.7mWindows x86-64

vpython-7.6.3rc4-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.8 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ ARM64

vpython-7.6.3rc4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (3.7 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.12+ x86-64manylinux: glibc 2.5+ x86-64

vpython-7.6.3rc4-cp37-cp37m-macosx_10_14_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.7mmacOS 10.14+ x86-64

File details

Details for the file vpython-7.6.3rc4.tar.gz.

File metadata

  • Download URL: vpython-7.6.3rc4.tar.gz
  • Upload date:
  • Size: 3.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for vpython-7.6.3rc4.tar.gz
Algorithm Hash digest
SHA256 18f10926d0a7768ba02ac1c161d53068ba34b2d29c0728daf03fc2678b2d8294
MD5 d0ac523cae6e44e2fb364013145c0de7
BLAKE2b-256 6121bb3a3696f686e0e84a02def167f230d42b6d408811929d16e71819f60594

See more details on using hashes here.

File details

Details for the file vpython-7.6.3rc4-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: vpython-7.6.3rc4-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for vpython-7.6.3rc4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 62df3c9295c2b343ca8153c286d392c55a17da9d3e0487696d2768e363f93bf5
MD5 87b8c509f8fd19cbf0bb89cfb46b0b3c
BLAKE2b-256 c6509ccd04fc83754096fdac7dddd1bb869af5605a165579ebe29a5e8979715e

See more details on using hashes here.

File details

Details for the file vpython-7.6.3rc4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for vpython-7.6.3rc4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a650099a869a9af84d8c2d0b5d31ca86a8ba285945704b7be851e54f95f23cac
MD5 903aa43e4ddaae6117d70cc152363c00
BLAKE2b-256 08af1f77966d73f618f156d222af72648ecf57af86d56d71d09315868104eef6

See more details on using hashes here.

File details

Details for the file vpython-7.6.3rc4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for vpython-7.6.3rc4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 71671694f76bccd9a80f4e2ace8a638ce30599bf18b30e2e392ff243969bfa70
MD5 6d2f499456c1c988aa94b2d1ffa0e24b
BLAKE2b-256 4daea0830f34cb2dda3953bf6c6b6d4d411200259a01c51206b9b761b09dc6e8

See more details on using hashes here.

File details

Details for the file vpython-7.6.3rc4-cp310-cp310-macosx_10_15_x86_64.whl.

File metadata

  • Download URL: vpython-7.6.3rc4-cp310-cp310-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 3.10, macOS 10.15+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for vpython-7.6.3rc4-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 94fd6e8474ee6a49f25cb9556ec4cce46d41b5479dacb569015adae2b51ca8d9
MD5 61a825fe44cd6a055f4639d2aa059246
BLAKE2b-256 bb15f6be28a8eb0a648feeb34a8050d69b5e69df0c633e6faf1fbd268afa57ca

See more details on using hashes here.

File details

Details for the file vpython-7.6.3rc4-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: vpython-7.6.3rc4-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for vpython-7.6.3rc4-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 d54509e4737f8f92024d6b6e072ba9e2f4c9c68e2baa1f4df5c3f8884cf462ee
MD5 0b6e348f385d52c571a9006fdb8d0f12
BLAKE2b-256 521dd5715d6ef1de6f595275e94a7cac4406d5101bcbed32b7d5a4e71f4671c6

See more details on using hashes here.

File details

Details for the file vpython-7.6.3rc4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for vpython-7.6.3rc4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d4a989b10f97cd32f537800c179d8b85c299991fbf3bb4b5d1fd7829f0fabaab
MD5 81c1ad77d4c6a6a757abf2a20e919e4c
BLAKE2b-256 f1348404f38a4b7fda3d72cf6f3306abc4e8c7562240d9e05cb0904b79b47c5a

See more details on using hashes here.

File details

Details for the file vpython-7.6.3rc4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for vpython-7.6.3rc4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 b6664490a32c5ccc9c26e8a8e0295493b37c0ecbad241bf23fd3840b03f5836e
MD5 65e9bf3f9007a10aaf1c7bd7ecfc31b7
BLAKE2b-256 6f88f34b5417af70792003508261e3e2bfa859d0716166cee163e2076a52f028

See more details on using hashes here.

File details

Details for the file vpython-7.6.3rc4-cp39-cp39-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: vpython-7.6.3rc4-cp39-cp39-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 3.9, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for vpython-7.6.3rc4-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 328bccd977e5190432d609e223b56c7ca8aaeef48b99736f5168fcf0354f5900
MD5 cb2a5446c43e68c06fb2d8b2f6a67e84
BLAKE2b-256 7255bedcf458e2c2ca1ae1b44368ee8d935a0fb720894a149b04d1cac12f3bf0

See more details on using hashes here.

File details

Details for the file vpython-7.6.3rc4-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: vpython-7.6.3rc4-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for vpython-7.6.3rc4-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 273fd633543e0aef7377c8aeaf7d1ad2a9e5d1d0ce221abe47a3ac6e95c58f25
MD5 fadcfdec794f8e5747e78cb7d7ae475e
BLAKE2b-256 eae52657e8e8a7ca61e63336cca0f5b3a20ba3a080d11679a3d59978b01956eb

See more details on using hashes here.

File details

Details for the file vpython-7.6.3rc4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for vpython-7.6.3rc4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a94e79c4d3d1c7a640be4e60e11d6bf851ad964172c1376f52032d5deb1270ce
MD5 33ca2fa4b3eafc7101200da9c87066c6
BLAKE2b-256 ab9d1f7ad9203a2bc07437189b83e024f0ad529d23d39c4092fa205900fb27a9

See more details on using hashes here.

File details

Details for the file vpython-7.6.3rc4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for vpython-7.6.3rc4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 dcb62bd56836cfb9f32161b4018aca085331d6abafd37575d508a4efdd0b76b8
MD5 f740ca096c5a25de5638cefbf6b4fdaa
BLAKE2b-256 e655f74766cfa97cf667935de1426779fc07a9748019a174fbb202161884c50c

See more details on using hashes here.

File details

Details for the file vpython-7.6.3rc4-cp38-cp38-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: vpython-7.6.3rc4-cp38-cp38-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 3.8, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for vpython-7.6.3rc4-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 07a9f4ce908fa5174c0df8c3f159186524e9a6d379814dea59c590db32257a82
MD5 d24f4596c4b4d6e9c24148dbd65e5492
BLAKE2b-256 3958ff95ddea30da0cc230ce6dce17bb38a5866fe956efd896d2f36d9b63d237

See more details on using hashes here.

File details

Details for the file vpython-7.6.3rc4-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: vpython-7.6.3rc4-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.9

File hashes

Hashes for vpython-7.6.3rc4-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 ef012a572a7dc94268e304656b2fbd7e964f1b5b536e5a24ed9ab70b38bb403e
MD5 cabc7832043bc8152cd76d10938c85f1
BLAKE2b-256 76cee996ab746aa4748639d1624b7ec6a46a20a0f2f2ea5af13fabaed4755cb9

See more details on using hashes here.

File details

Details for the file vpython-7.6.3rc4-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for vpython-7.6.3rc4-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 65f0884362fcfae065e6d93c6e4c82b44fe22124a3004b49d4252fb1d2965e1a
MD5 3a40cc5fa67e65d1fdb8376573ad7b0d
BLAKE2b-256 30d2d27a8c2690460eeef9045a43fb9023353a99c23c06510e7363bbc368f3a8

See more details on using hashes here.

File details

Details for the file vpython-7.6.3rc4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for vpython-7.6.3rc4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 c84cfdc903c0dc7280843ffb2202b1a1d7423d74d024e88f412ca3affd8495d4
MD5 997d4dfec7d269936730a0efb421026c
BLAKE2b-256 968ea8b7e1f5ba457ed686609152fca0c085bc6c83ce4356306a0e3a13fe3f6d

See more details on using hashes here.

File details

Details for the file vpython-7.6.3rc4-cp37-cp37m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: vpython-7.6.3rc4-cp37-cp37m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 3.7m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12

File hashes

Hashes for vpython-7.6.3rc4-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 703bfcc21e9d8f6d27c5665dee0ae9af57b628d4fe2ae342cd93425ec1759183
MD5 1cce6a73e2589a2b428e83564bf48bbd
BLAKE2b-256 4c2ccdaf9baff3d11a7c3ac3ead601b097dedd63070b6fccd2aa850418b8e254

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page