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

Uploaded Source

Built Distributions

vpython-7.6.4rc6-cp310-cp310-win_amd64.whl (3.5 MB view details)

Uploaded CPython 3.10Windows x86-64

vpython-7.6.4rc6-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.4rc6-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl (3.7 MB view details)

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

vpython-7.6.4rc6-cp310-cp310-macosx_10_15_universal2.whl (3.6 MB view details)

Uploaded CPython 3.10macOS 10.15+ universal2 (ARM64, x86-64)

vpython-7.6.4rc6-cp39-cp39-win_amd64.whl (3.5 MB view details)

Uploaded CPython 3.9Windows x86-64

vpython-7.6.4rc6-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.4rc6-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl (3.7 MB view details)

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

vpython-7.6.4rc6-cp39-cp39-macosx_10_15_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.9macOS 10.15+ x86-64

vpython-7.6.4rc6-cp38-cp38-win_amd64.whl (3.5 MB view details)

Uploaded CPython 3.8Windows x86-64

vpython-7.6.4rc6-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.4rc6-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl (3.7 MB view details)

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

vpython-7.6.4rc6-cp38-cp38-macosx_10_15_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.8macOS 10.15+ x86-64

vpython-7.6.4rc6-cp37-cp37m-win_amd64.whl (3.5 MB view details)

Uploaded CPython 3.7mWindows x86-64

vpython-7.6.4rc6-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.4rc6-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl (3.7 MB view details)

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

vpython-7.6.4rc6-cp37-cp37m-macosx_10_15_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.7mmacOS 10.15+ x86-64

File details

Details for the file vpython-7.6.4rc6.tar.gz.

File metadata

  • Download URL: vpython-7.6.4rc6.tar.gz
  • Upload date:
  • Size: 4.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for vpython-7.6.4rc6.tar.gz
Algorithm Hash digest
SHA256 a03b5a5c5d9416044e90c33febf342433525e18e951bd32121abefaf791c2d72
MD5 b62efbca0ba6d443eee41dc00edc80d9
BLAKE2b-256 569792d7da07cce80c80af2e181a242b69c9e09b0ab214ca45a75a9d60336071

See more details on using hashes here.

File details

Details for the file vpython-7.6.4rc6-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: vpython-7.6.4rc6-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 3.5 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for vpython-7.6.4rc6-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c26a520c31819ae21c8026feaa8fda599f0e325d500e68d740617bd88172c0ea
MD5 179145e62986265f349111f75207e173
BLAKE2b-256 079ad6fd6b0cc76559cbc4d0bc17dbc12394184b7e971f461aaa7790e547874b

See more details on using hashes here.

File details

Details for the file vpython-7.6.4rc6-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for vpython-7.6.4rc6-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 32dea83083c783f8b6dafdc201aea2e999d696df178c1325822e6a42503ef079
MD5 ced591969c271c982dc88a7bc6a37d8a
BLAKE2b-256 ecf426a46136cc4302294404096802aba155fd018452a39849b916d3f4fbed2e

See more details on using hashes here.

File details

Details for the file vpython-7.6.4rc6-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for vpython-7.6.4rc6-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 560892525df7bc823bf15b06600689fb38f112a3e5552b91c587544a79660c93
MD5 80a9b02f3f44e50f3a9b4a86ea60d798
BLAKE2b-256 6e235917f0055c2fd4ce40130e8866de05df2e659e444d87da46ced20de2d575

See more details on using hashes here.

File details

Details for the file vpython-7.6.4rc6-cp310-cp310-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for vpython-7.6.4rc6-cp310-cp310-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 7de5b9e50c4e7df17f2643aac5144b4644dfefa84923b8ea38a15b294912c769
MD5 c60cc5dba61ef9511c712e35339c1166
BLAKE2b-256 c2940d04c33245b058f9c262340b8035344c9bd9df757cde2e3652de5aa96401

See more details on using hashes here.

File details

Details for the file vpython-7.6.4rc6-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: vpython-7.6.4rc6-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 3.5 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for vpython-7.6.4rc6-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 497e2d4e7eae40805308320033dac65d09bdd2e591ac0882e449de93b8486645
MD5 3122023797c116c28fb24f4de9bf7f78
BLAKE2b-256 d6606f21fe362defba1359456764a2d828f50494740b855b0642440ff70c208c

See more details on using hashes here.

File details

Details for the file vpython-7.6.4rc6-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for vpython-7.6.4rc6-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0552cb23b5baf6ba541b8119d20aa9df777c9daaf95f53ec3709d3e3a8e6d542
MD5 b0dd6260cc72cf2554b7e4198cdb539e
BLAKE2b-256 06ac8b60dca0dffad67694730ae690aeee145c3faa1c971f30abab30575de8ab

See more details on using hashes here.

File details

Details for the file vpython-7.6.4rc6-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for vpython-7.6.4rc6-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 353268bae841400a642c9e60aad1cb458f68fe137109cc50db2aadfe1d19477c
MD5 3b1f28fabf61c1647017409c4ed891d5
BLAKE2b-256 80794f03756fdde5ccf79c536484b8127c793d9a04fa3661957fadf5541b3c8d

See more details on using hashes here.

File details

Details for the file vpython-7.6.4rc6-cp39-cp39-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for vpython-7.6.4rc6-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 ca75b6d6d10dc17535fe2fa5f53cf0941c3a984879ef71a2b8de2c3778e399bb
MD5 6da6615199dbefd84165390ee6d598de
BLAKE2b-256 88985d8efb728d1796dd747f4011d3132d85e644a7936f0c50b6f15f3628099b

See more details on using hashes here.

File details

Details for the file vpython-7.6.4rc6-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: vpython-7.6.4rc6-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 3.5 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for vpython-7.6.4rc6-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 8d77d5cdaf0e0b45bc05de5417bd5d781febe7e886c6b4cf93c4f19f581db7b6
MD5 558d40e14801744df37f58de537a7d51
BLAKE2b-256 d46d0fab37c7a25cf6b189f2d7dc66af90560766f3f9938556b76aed1f084670

See more details on using hashes here.

File details

Details for the file vpython-7.6.4rc6-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for vpython-7.6.4rc6-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 10f9d52b126341048efaf222584dba6f828a04734c6e9d7ec979c520f9a4bd96
MD5 1e1f94917ef5042392f794d1467aa874
BLAKE2b-256 32fa71d411aeba094173c0c79540ba653d7c83b18d5a3edf8bdbe88a8d9ece13

See more details on using hashes here.

File details

Details for the file vpython-7.6.4rc6-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for vpython-7.6.4rc6-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 f520481ce49e42a28d683bb380d114f01f89b6c90fd2a3d5a5aca58192d7803b
MD5 641539e6e0517c3d780cf6c640a6fe16
BLAKE2b-256 03e68f1183f74b6eb0f2626c17d1e90ec562ce341d82ef6bae1a719ebb1e1065

See more details on using hashes here.

File details

Details for the file vpython-7.6.4rc6-cp38-cp38-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for vpython-7.6.4rc6-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 6f8c2d98a9c185a5604eae45531319788b5de69a25f9770c5d4706d36b20655a
MD5 33a05adc21fda8a3254e90926d8c8f66
BLAKE2b-256 c0f7e796d65c2f26bef06b0ccae3b0c09e05708445bcbeb9e177d1e74017ba5d

See more details on using hashes here.

File details

Details for the file vpython-7.6.4rc6-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: vpython-7.6.4rc6-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 3.5 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.9

File hashes

Hashes for vpython-7.6.4rc6-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 0bd953a82fb3e5b119bee82e477499996b72047fe5fa6827d651fd66ff5c8bbd
MD5 5f78cf219e1471137979571eda8f2970
BLAKE2b-256 86b62e8cabb28530bbdd7382d025b418a901a9563cb8cfcb6e83b2543dd974cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.4rc6-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b151c401b0150243d6c14d1ea26f9b93687d5ba1e90397028f7ecc113c3dbe1e
MD5 b7977778a3f25dca14552efc59fdec90
BLAKE2b-256 dc8e1b582ebd4c3611da8bcfe0bd1d3b29597c7435d6eccf634eb1f34542ee0a

See more details on using hashes here.

File details

Details for the file vpython-7.6.4rc6-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for vpython-7.6.4rc6-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 e38228c63013fa7518bb9cd453a12b1d4db4fdc5b0b90933f8652a05c4d80c9f
MD5 c0798a1b7ead6bd1827e14ba7c7cad51
BLAKE2b-256 2ba0b96c05bb396cc76996b566d44e5fa107be40eb9e4cd76c53de030e58256b

See more details on using hashes here.

File details

Details for the file vpython-7.6.4rc6-cp37-cp37m-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for vpython-7.6.4rc6-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 996d31ab8929255b4f667853bd1d84fd4ea25bfad84dc853b3d9b70f64576dee
MD5 61831fc847fa333ab75763d652150da7
BLAKE2b-256 4ca4348f9a280ce1b25ade81ac513760b691e8b536ec392262e5ca070ffbe75a

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