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.5b1.tar.gz (4.5 MB view details)

Uploaded Source

Built Distributions

vpython-7.6.5b1-cp312-cp312-win_amd64.whl (3.6 MB view details)

Uploaded CPython 3.12Windows x86-64

vpython-7.6.5b1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

vpython-7.6.5b1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

vpython-7.6.5b1-cp312-cp312-macosx_10_9_universal2.whl (3.6 MB view details)

Uploaded CPython 3.12macOS 10.9+ universal2 (ARM64, x86-64)

vpython-7.6.5b1-cp311-cp311-win_amd64.whl (3.6 MB view details)

Uploaded CPython 3.11Windows x86-64

vpython-7.6.5b1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

vpython-7.6.5b1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

vpython-7.6.5b1-cp311-cp311-macosx_10_9_universal2.whl (3.6 MB view details)

Uploaded CPython 3.11macOS 10.9+ universal2 (ARM64, x86-64)

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

Uploaded CPython 3.10Windows x86-64

vpython-7.6.5b1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.9 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

vpython-7.6.5b1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.9 MB view details)

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

vpython-7.6.5b1-cp310-cp310-macosx_11_0_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.10macOS 11.0+ x86-64

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

Uploaded CPython 3.9Windows x86-64

vpython-7.6.5b1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.9 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

vpython-7.6.5b1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.9 MB view details)

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

vpython-7.6.5b1-cp39-cp39-macosx_11_0_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.9macOS 11.0+ x86-64

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

Uploaded CPython 3.8Windows x86-64

vpython-7.6.5b1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.9 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ ARM64

vpython-7.6.5b1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.9 MB view details)

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

vpython-7.6.5b1-cp38-cp38-macosx_11_0_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.8macOS 11.0+ x86-64

File details

Details for the file vpython-7.6.5b1.tar.gz.

File metadata

  • Download URL: vpython-7.6.5b1.tar.gz
  • Upload date:
  • Size: 4.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for vpython-7.6.5b1.tar.gz
Algorithm Hash digest
SHA256 142bc3e7209ac1fb58549284812b5a9a9ecd012c1535871fcdf6f34e93d024c7
MD5 2244bb5e0d481fbdae68c3e59ac9baf8
BLAKE2b-256 60772dbafd3ac266f5676ec00899cb70e6b701ffbd3486254b47f4b55e8b6966

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: vpython-7.6.5b1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for vpython-7.6.5b1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8f7d62d0a5d26d9d3300065e5aa4c5e5cefec1f39af5f4b6a993bba0c18b8351
MD5 32eb6d9dd4ada4a5a0ccc2e5a25b16b2
BLAKE2b-256 2a80246d64c448f6051822665ce6d195814b76708c41b06d047321daabcf317d

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for vpython-7.6.5b1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b34765ce19584b9ee5df6cf270c29dbae8fa33a9293342561012bdb7dcf503d3
MD5 58656ae6501d0c664827db5327149daa
BLAKE2b-256 b5354e3696641602e4bae22e09750c1df7102d0ecbe70072ad5dfa1338379a40

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for vpython-7.6.5b1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6cb1d2e5d591cbd808d0e5464c94a571d6c10c9bd56c0da116db9d9e0b50a22e
MD5 7adb9492b802d7296b2fcc7244e7067f
BLAKE2b-256 36b428ae54e005afb1da59e48425201a7550dbf2783a013ccf4e190761dd7aae

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b1-cp312-cp312-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for vpython-7.6.5b1-cp312-cp312-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 7e527c3217b7fd87069e83f06385b89059f2b415177fd63dfb8a2764898f2ea3
MD5 257de59f1ac6e56efb9435112735f338
BLAKE2b-256 58feb77cc12d2228099dc3ebb6d85d6ddd1e42f98f7fe228934d274a0ce94b23

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: vpython-7.6.5b1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for vpython-7.6.5b1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 38ac34ff3d76fb6b37c34fbd2b0409e9f18626a7bcce90219129d3cdf28e386f
MD5 de747544be6da1c755737d843b865052
BLAKE2b-256 ef5ffed580a80e066b51a9441a921f3d5c1dca76d36e31e782158f25fc3d4e76

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for vpython-7.6.5b1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 50ccecbbca7bf3923ade7265befebe5bbe609922526b42a652a16e95631ab6d9
MD5 8995df2a6eb4cadf8e1e63cd4eab35c4
BLAKE2b-256 baadb8d24082e3a71b44c2e02072fae166febae5e211f9fa72db79d7963cec4e

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for vpython-7.6.5b1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 57d32997bd6ce598f546b0d03994113bc03b39c6f54ae94209c9d9aabeb58f7a
MD5 36eb758b23ce887363b6bac7afb4564c
BLAKE2b-256 780d576871b7c4bfe1365908e29586b36f8e4780c653526c121b9d7dce3d0deb

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b1-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for vpython-7.6.5b1-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 5bea0390abfa4fb29e271e51d263e75cdf4fc510c5d25c903fae697b3ce7237a
MD5 283849a80861f9aad0f416da942c2557
BLAKE2b-256 be627dfb6b007851f2cfec50c86b115276836556c28d7f2610b8a0eb22bff905

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: vpython-7.6.5b1-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/4.0.2 CPython/3.10.11

File hashes

Hashes for vpython-7.6.5b1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d85529582d1002450cce6ddb8c7e6c9de551d6ac843850f6a01afd50fc71818a
MD5 280a3449e5eebc014959025ff1621c3d
BLAKE2b-256 de4a8585347c29318c94914d0d351970125ffba0e96000e4cee5c463910e5ada

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for vpython-7.6.5b1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8b25466d8bfe6df32ae3f15b336ed6e471baa71a945c67ddce4338efbe78794c
MD5 f66ab052a16e2f13a46d7459a6075328
BLAKE2b-256 ce20db049605929136c0df909ddde9686a22e93bc6b832512faa27ccff3c7ee3

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for vpython-7.6.5b1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a916f9fdb13b97b2001f9b910fc3d2f9b8a6191b6563b48f045ad9595219d656
MD5 44e9dac5eee4c59c6f234ebb743d7272
BLAKE2b-256 d5d05de8f8182924d163c9db3f154834dbb4b76173025bf70cff4275cc035650

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b1-cp310-cp310-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for vpython-7.6.5b1-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 c90c553966781a98cbf73395d9a95fc44f3536bcf3df0391b8f09680e13bde57
MD5 e08fd04a2ed68cc9fa273477fc6b38b8
BLAKE2b-256 380058829b708949d02892dea2f255ca45d1ca12fd9a787bff11085a665df760

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: vpython-7.6.5b1-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/4.0.2 CPython/3.9.13

File hashes

Hashes for vpython-7.6.5b1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 c676177631429ac4915e5a4fc7d760dce251a40ddefca0eec0b92b06f5766dc8
MD5 8c1262300f5e52f8f75c415bfc29be5d
BLAKE2b-256 54e342b64744baaddb5aad8a7638e38b2b4bcb86cf7711fb67c94856ba06fe16

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for vpython-7.6.5b1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 cb26b6c64345395d6cfb4f1d693e0a57b2a618f95f2147e397c7db35cd629a55
MD5 faf47f807ff8217c8df5a73fc8b91cc0
BLAKE2b-256 c75c7589bd6bf3f3599ead5db07ba9f9ab3a52c7eb06fe7f9d88a7a74e6221be

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for vpython-7.6.5b1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 06a5796de6b8b92f3be6038fdaf9c548b6b37d9fb51ba0a9523eca3a5a8649f0
MD5 c74ecb1b0fa214b73b8b363c5d8c4268
BLAKE2b-256 f743f6122257031ee53f42cddf1e527ea66c638bc9b8f7829c79f738a152bfad

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b1-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for vpython-7.6.5b1-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 1c78756fc8675df404b8427054c3f86d50ac31f3848d7e1910605f6ca3bf2d05
MD5 ea956cba69e23f18af564e98e298b38b
BLAKE2b-256 055b61301f4834ae7a22edc3aea6b01ed661c99857441350eae15f31b58095ce

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b1-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: vpython-7.6.5b1-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/4.0.2 CPython/3.8.10

File hashes

Hashes for vpython-7.6.5b1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 1b8b1cb06f2f5fe9e18c9589cc8ad1db6a504195040e3478df9798d560869c23
MD5 e4857d283c569590ccd3df86bce790a4
BLAKE2b-256 4a1b8d04b853839d324d40f0a64cd8ae70e4a115c0f004aae2954a821494a19a

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for vpython-7.6.5b1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ec6d3853fe3b32b7f0ebdc0912dcdca29e5a4b0add804a432129564b585a78c1
MD5 17f37623fe724aa038f99b25396a2841
BLAKE2b-256 b05d109fe0dca2a13ee9e24ce14f5c9f72527b1bede8d0f72036be178cea7719

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for vpython-7.6.5b1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6336438a756a354f801cba220bf8666c076473e084e1a5e87b247b261fe34f45
MD5 c3414f4ca07c933969ad3703d867b74a
BLAKE2b-256 f1575f7c985fd83cfd22f01568c82b9a3d6a01baeb43eac5b81891e2eddb849a

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b1-cp38-cp38-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for vpython-7.6.5b1-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 e4b0c3b91ccb894ee71aab2aeba08f18c2180623b525bff603eec26775b93e3a
MD5 9217d4ff85243e85460451df84afdc12
BLAKE2b-256 4182117baffc82184b16e402b4dfe17967d500cb80db1ec9d466381a988a5488

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