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.3rc1.tar.gz (3.6 MB view details)

Uploaded Source

Built Distributions

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

Uploaded CPython 3.10Windows x86-64

vpython-7.6.3rc1-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.3rc1-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.3rc1-cp310-cp310-macosx_10_15_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.10macOS 10.15+ x86-64

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

Uploaded CPython 3.9Windows x86-64

vpython-7.6.3rc1-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.3rc1-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.3rc1-cp39-cp39-macosx_10_14_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.9macOS 10.14+ x86-64

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

Uploaded CPython 3.8Windows x86-64

vpython-7.6.3rc1-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.3rc1-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.3rc1-cp38-cp38-macosx_10_14_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.8macOS 10.14+ x86-64

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

Uploaded CPython 3.7mWindows x86-64

vpython-7.6.3rc1-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.3rc1-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.3rc1-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.3rc1.tar.gz.

File metadata

  • Download URL: vpython-7.6.3rc1.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.0 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.3rc1.tar.gz
Algorithm Hash digest
SHA256 21fb106c6b1f9a12d8c76e64419613bf4c78dc2d769d370694d79727febb9df4
MD5 8b7ad5bd0058fe22cf50965b96f7a7ba
BLAKE2b-256 6ccdd1f04d265470670a0f43d2c25aeb9a05af8c8e5a36f38f3c705dca5a84b0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.3rc1-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.0 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.3rc1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 926add273e67742a126a6cd20c5c5558254cb5c0c567d68ab09ed09623889941
MD5 925ffe38c0f892104695265f5742a433
BLAKE2b-256 0aa2b97a6c6f3e7d488fcdb4a0fe2269185acdcdea1a35e42dc4cda2c5225881

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.3rc1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5da669fd8059036da5f74f35b93ecdf928a00305b943cbb6a0f9a065077528d3
MD5 1635f1aaf960890de720b6a30f57dc4a
BLAKE2b-256 bcee80d994d2535a5c465ce28fc761123027911c2e366e7e3b96984b0d10dbbd

See more details on using hashes here.

File details

Details for the file vpython-7.6.3rc1-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.3rc1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 f45268eea775435a6dc46e30a9c284f709fbd223d9d89d8bdfae0229e638fced
MD5 a24840a94dba23512da9c07367b38d5f
BLAKE2b-256 3703d490e3a070f679621cd8c3312956a9337124e9f3931e6d783c1559296560

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.3rc1-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.0 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.3rc1-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 59b98b9bb717011eb66d4a1ae6182e7308afb73186db86b3227346ab17015942
MD5 dc03bb4a86a47e610e9244372c8d4054
BLAKE2b-256 513c7a6999bee02ee0cbe458eeaa656d28b9ed128976bf0e6875051759148a6c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.3rc1-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.0 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.3rc1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 6baba6fffc7662511a1b26dea8deeb8ecf0d5a154e95aa7a43fb2fa5a7e4e61b
MD5 9524bfcb71c7442a1cea7c8387f3717e
BLAKE2b-256 0f45e7c9683c430a7f6b207edc81375369e96f56a38422451ef8bc3721eb3cb8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.3rc1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c486d864d4dd02ab6e9123c278d49551d89acd2dfa7d70267d74e782c7b95e15
MD5 715c896f045aa12fa916c56ff2986bb5
BLAKE2b-256 d877e84c1fcf988ac519c52a437cb6a53964b75c7f2471babe84de15e945a8ef

See more details on using hashes here.

File details

Details for the file vpython-7.6.3rc1-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.3rc1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 9a30f3080ee643579e933dff02b1b21b7438510eb1a4e2d4ea36f66819792739
MD5 1395a970e350a36b9b47d22f4d0a60fc
BLAKE2b-256 d4b856c363f1d4259d77566e59bc187a78e63e9c4bc4606738a4cde00a38d1d3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.3rc1-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.0 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.3rc1-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 8c41f434a70965c1dcfcd9045e12c8ac5f99a4dcd2631008f81766989a708c63
MD5 6d9665fa661d57edd801083164cc3303
BLAKE2b-256 1a4f20b4cfb21159dacf5c5fa4b61448e2f1cd4fed3395a577d5f12cc81802ba

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.3rc1-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.0 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.3rc1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 07f7b405bfb91248072b90f1ba6081657fb30ff8112087ea17d00aee2d4470bc
MD5 37d08c4f7c749ed7776a45b5ca3c07f3
BLAKE2b-256 42be61efb67940d3903b6e73bbdb1019a66bffdb44236e5618ef681f748dc43e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.3rc1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1126034f2dc26e0e8797487f40a833223aa7bd7b83284b88064e4cc49eeb070c
MD5 144a36f86847fd4bdd9ce3aacc64c48b
BLAKE2b-256 cf2847e98145f1702dbd93991adc3effe0d3ffa04c1d4562e5e2a584ea2971b0

See more details on using hashes here.

File details

Details for the file vpython-7.6.3rc1-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.3rc1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 560d26f4c21d454787454ff3ea66e67748a67bdbe0943a1cb782d3bf72d49b57
MD5 0ed56385cc4c01579591d2b2e42516fa
BLAKE2b-256 31033f99f6d3d01fb74e59d1a1cc9b14e8a0840eff13ff2770c3dfab580a60f3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.3rc1-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.0 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.3rc1-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 35e892b3f00710a5e60d505b604257a2e532391000904228ec4f3bbad92c3e07
MD5 17ebd9828baeca8b38de6f5368957d7b
BLAKE2b-256 fa4a24bac98b9473ea5c651f4ae68efc555ee529a68471a4c81184e0a4457a1c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.3rc1-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.0 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.3rc1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 08e9b79e17fc71ced8547e4183045e21c0015422432fbc40d30212bc5c442680
MD5 cf3b31aa8aa292819ea0087a4c6c6583
BLAKE2b-256 42b17490842ad7d1b78b0682699e2fe20c48a221c9eb6a524088b9262ab03692

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.3rc1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 83960dc6f0fbf8cd89dab45918a5889c45078d75bf80b55696203a1812bdd93e
MD5 68f01961cf29b0fddb90f57cf9492ec9
BLAKE2b-256 3fa8f64cc108ee43736d91dccc4440c8b1b9e66110bbb16125cab6646091166b

See more details on using hashes here.

File details

Details for the file vpython-7.6.3rc1-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.3rc1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 ece13b741e6fa7dbd1bbf4dc223c99fe11c1e8fb49536e2079e611755a20b787
MD5 90752bc48dc411def64a7c30595bd5ca
BLAKE2b-256 863334bb1734f21f624859b68c2a6472be4c25890ab3c8fe242831f4731dbb54

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.3rc1-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.0 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.3rc1-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 086d9fdea00fd037e8f447f01e6aa6fdcafe487d6deddaae8fa061a62040f8a6
MD5 a1ca74012bded2f75640d1c147215420
BLAKE2b-256 d94515eb43793cd720fce5129668c53cb8e4e46d55fc14ee4ab715da544b3610

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