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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 10.15+ x86-64

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

Uploaded CPython 3.9Windows x86-64

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

Uploaded CPython 3.9macOS 10.15+ x86-64

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

Uploaded CPython 3.8Windows x86-64

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

Uploaded CPython 3.8macOS 10.14+ x86-64

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

Uploaded CPython 3.7mWindows x86-64

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

File metadata

  • Download URL: vpython-7.6.3.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.3.tar.gz
Algorithm Hash digest
SHA256 732ec3a1a57a55efd2eb1b27e4f2eaa5fe061f081b215a820418eca811e51e40
MD5 d58b6794cb9714138bd902e46722f448
BLAKE2b-256 519999ce1bb44e4dea87c764963744d7e99f44d74fc0106a5cb243594db5da30

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.3-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.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d9da11f8c938ae975cfa62f52e12a754011a1455b1ad99d62509a3ea6e08e9d5
MD5 3b86ac03688efd0f14c78d915f5fc809
BLAKE2b-256 49a351a364263bee95eb9c827eb7bcd4a854e0629b57b8eda8a5884d24521082

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 72ea6f1fd226f68f29bbcdc10c481d91eda6f5e1b633b0bdf4806b1023b262c6
MD5 c7e9f640f3ad498a97cf50d886b0eade
BLAKE2b-256 157bf0d2f61215858169a647fea7fced0801a132201bb57e333c0f3edd1157dc

See more details on using hashes here.

File details

Details for the file vpython-7.6.3-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.3-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 d01b2e60685fd3d9f9303e589f1c3dbb50f9cc5761ead1b017b7f8eea3dc7538
MD5 1dbf95ec99ace9efc37a0a6a7f3b7506
BLAKE2b-256 4267faa8da5009ae8952de770be54ed39ed895584112c35dbb0929c4dc2e91b6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.3-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.2

File hashes

Hashes for vpython-7.6.3-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 f7c0b243998eb12cce99e1aa4dd222e8aeeaf73d9dc251ee79d1f64980d9d4b3
MD5 ff5edf2bd74dc82eddb092c68401cff1
BLAKE2b-256 01492de55c458ee5cc51063cf97faf6caeafa1aec822d6b7a16cd0a6872552d4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.3-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.3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f7d6c700e350a7fdea1b630285a0ee13e2237613b42a81a093cb3e7897f42095
MD5 b850c648e440f812a3677119f1811a78
BLAKE2b-256 d16c2ab0c5859d4eb838ad9a06980af7bcc9878dff5e25ca691410f904d6b7b7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 26e265b2ae5d1877d0aabee2c12fafda97f5eb2ef1150a1c40dbfe1a3ae9d771
MD5 710b1aa6bf24aedc662610095c505067
BLAKE2b-256 af5fc97c7dc626bb83955d25cae25aad2a69f6198e3e97934e28a494ea6b87c0

See more details on using hashes here.

File details

Details for the file vpython-7.6.3-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.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 6aee50387ecec3da58fe20a142987fca8cee1e9ac15a39aa5660311e4925caa8
MD5 84fb2f8e3a1390ed1e7865bd5d05528f
BLAKE2b-256 cca466bafd7c71b8ef4d6f9c5ef07ab03ae4ae981a460200bb37c99f9c1250af

See more details on using hashes here.

File details

Details for the file vpython-7.6.3-cp39-cp39-macosx_10_15_x86_64.whl.

File metadata

  • Download URL: vpython-7.6.3-cp39-cp39-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 3.9, 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.9.10

File hashes

Hashes for vpython-7.6.3-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 2c1467f542539559e36fead6b636cb4c86feb97cc57c282f9db7e60a773de1a3
MD5 0c81c2abd827fac1a31d5122eb70a1b5
BLAKE2b-256 6101f3a13b1f4eacfc07b1b11402dc8715c771c4c884195347ca40fdcccd909d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.3-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.3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 3090e5f27d884b7f1d58ba02c56a1cecd117b1229cf47a9141b53d0edeb6a1db
MD5 784565832da99b029fb3450311254a09
BLAKE2b-256 cf4f0ad87ca4452e2a726954ee47c5f6c3196df2ec004428cb9221b87cc7e6bb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b0ba625c2895799624edf64f8cc9813e4d4de7b17c0984c44598e78668005c34
MD5 3c8be3daf042c1a2343995a6b8a3808f
BLAKE2b-256 97aaf1ecefa22b2da998276840a890620951e9d3872df992b2546fde60efa4ea

See more details on using hashes here.

File details

Details for the file vpython-7.6.3-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.3-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 203d2a9cbda2afcad44035cdc141a005af65ffbae08866ac60b0c87587f7ef39
MD5 bebb9c223d520d5206e0f8619331b4ec
BLAKE2b-256 a5e858a616c984658b9916af787063c885543904dc0e21d15a51f3d1ac20757b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.3-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.3-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 496dae461a54d383f6e67e9beec2ea3f7de47e62e4e83f9d1c1ecba32d12bb99
MD5 c5dff9f3cac881562616ec9a3175a824
BLAKE2b-256 ece63fec5f635bbff1851bf820124af9df799db6c898c2b3f9be42f12041498c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.3-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.3-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 84ffbfa416e1f7a172047eb86d6cb32cb617c767643562b28d23ebc4dfa43c63
MD5 e8eedec6efecb17c8557f5a1e05132cc
BLAKE2b-256 f6d0738ed7482f303daa3ddeee5e86ee938fe566d433d1d07b5fc781a56b9c50

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5895a4bfba040c93261b6dc4503dfd11342e6f0440c2a57823e2476ebc066deb
MD5 0ba6a2c7d0ea593130b1dcb6fc3c3ed2
BLAKE2b-256 d77084f40f217ee6da7ba23539863f852e665ee0c67c881213c977a2c7e6b64b

See more details on using hashes here.

File details

Details for the file vpython-7.6.3-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.3-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 355c0716c93ffbc1ab842daa832115b34671b177333d2b1ba26b997df2b818e3
MD5 bbd64c176347bc0c2f1c1005ce9541ec
BLAKE2b-256 83b347fd47e6ef0a49d4f35402cb10f8d771910476715983c507f3fc502d0694

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.3-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.3-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 10633b7c17baa178ed07aaeb7d4effe4d8fba7db02cb5f484b2bc0e9a694b142
MD5 695f78e24086469acce52881ac0a73ae
BLAKE2b-256 67dab8f5e4ccab3a9c6e67041b2a98b53d7362cbf454946a95d040c1491bcbfd

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