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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.12Windows x86-64

vpython-7.6.5b5-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.5b5-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.5b5-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.5b5-cp311-cp311-win_amd64.whl (3.6 MB view details)

Uploaded CPython 3.11Windows x86-64

vpython-7.6.5b5-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.5b5-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.5b5-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.5b5-cp310-cp310-win_amd64.whl (3.6 MB view details)

Uploaded CPython 3.10Windows x86-64

vpython-7.6.5b5-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.5b5-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.5b5-cp310-cp310-macosx_11_0_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.10macOS 11.0+ x86-64

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

Uploaded CPython 3.9Windows x86-64

vpython-7.6.5b5-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.5b5-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.5b5-cp39-cp39-macosx_11_0_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.9macOS 11.0+ x86-64

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

Uploaded CPython 3.8Windows x86-64

vpython-7.6.5b5-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.5b5-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.5b5-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.5b5.tar.gz.

File metadata

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

File hashes

Hashes for vpython-7.6.5b5.tar.gz
Algorithm Hash digest
SHA256 a8ade9a1499ea60fc7549cb55089db5f8f8e633fa410801306ccbc64dece7230
MD5 b485382c5d2ba44e708464b900d5ceff
BLAKE2b-256 50b032c7ae0ebc88344121bc8273476e359cecd8f40f27c045c78efdddfabff1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.5b5-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/5.0.0 CPython/3.12.2

File hashes

Hashes for vpython-7.6.5b5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5514cfddf457ac22240626b59165efe14e1c9d92ba45c74ab092df733cb635f2
MD5 61f5ae1959194031283434dac29c38ba
BLAKE2b-256 fa7f1a6365203c2e0c825ea3a2761054b2e7de5686e94fb8b1599e7f87c87e47

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 33231343b6f52843b0183739ad00ada6695916a6545e4af182177437112268c0
MD5 f5b8b09cb98d76a402849f74abd9a99e
BLAKE2b-256 1fbbc78f87ba2352ccdd17ea85d0bdebaaf0dfabaedc871308722da15c8b8a2a

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b5-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.5b5-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f4980041cd9bba6de1adc2413881d1c085b65b2405f38e47912400a183ac33a2
MD5 9d91ca776f2a80c27df99543e892002e
BLAKE2b-256 839e072af47b0e522f578645cafec98ba65d7cf2dac54582b7fb4c7bd7680e21

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b5-cp312-cp312-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 6e21c37570a95da73add2bf51a8dc24dae35ee694e73addb3887e72cc4b148ce
MD5 62c5372f05f96ba3c2e14a0c9577e8e0
BLAKE2b-256 29000def157152749b35aaca2ee203c96a592cb5b37e2ef4468dd11ae4d8399a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.5b5-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/5.0.0 CPython/3.11.8

File hashes

Hashes for vpython-7.6.5b5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d56c5902a271d2912d44e608b56c65230820bf9c261500d744aaf4ddb8b32c8f
MD5 f4cd22d8f13d396fc501f9a80313ae6b
BLAKE2b-256 b06dc113ca06a113b53fca1ba4a27fce541f2f2882426ce4d465084afaa90fad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 61fa01fb69d3889de8b71e10c9855839327e47934efe18bd191d0602838ab6ef
MD5 269ff9ecf84415a3ee1b3fe5c7034a3f
BLAKE2b-256 fd7409203cf79a713e03941d4140cf0ef6fffb542334ed18216d15e97190aa92

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b5-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.5b5-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 02ba039b49cb7a2b9565e1eb57ea188c1391fd6e35bdb60fc9c7cdab67081537
MD5 a9a75e4cfd186deaf2844b5437b517ea
BLAKE2b-256 d2f02121ed697b732d99bb132c0b3ea492b2eda16db3b4a8676e14c98a780648

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b5-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 77c5e8e74ebf18fad0fe9e86e850a73a7855fbf4ba6d832ce99d45b59d576411
MD5 cb015f3317746e6052d5667002ec0b54
BLAKE2b-256 41b1ff5768f17f9f8f9c42e551d105e5aa7716ae94935ab929df9a05b55bc1f9

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for vpython-7.6.5b5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5a0d34472ef3a9a75c0e1f776aebbefa84a5cb2fdafa1e9835e788e8cc01ca13
MD5 0e0c16cd308645a67556fa9627103595
BLAKE2b-256 1c8153654ebd7872efae8d35e057022d5f63464af5e2c136b73e9ea12a26ff0f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 59ffde588f660568e1e8031aed980ace925ff65a196e3a360b9ceb98c041a151
MD5 4d27d8fe17c5c8a3b00d3d27466f1bae
BLAKE2b-256 161d8567a7b2012b12282d0aae3f9b3180e63ed5493e050b58cfc5f05c2d7557

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b5-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.5b5-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d1935add29d2f2cbddb35d956af424a1214906c098b6d14a1d5560976415a832
MD5 2bd28ab88db32d2ddad630173b7d2dd9
BLAKE2b-256 5db2220cc97cd5641ae3427ce7e3c96f2c3a72a6025d89c2731604c1448722c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b5-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 f98ed7b03a32e8421a87ec3836997d02b560d5391e7acf0ba4285d3c8fed74c0
MD5 15821471575b598f171c7e711dd8eabf
BLAKE2b-256 21cfdd2ff33d982c38e435ae91054453bb084c2ba6416176c9421d485eb6462b

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for vpython-7.6.5b5-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 ce556b92862a41d50395027205f93f1b197baf5347d64f6fe1761ed885fa4b90
MD5 79a877d5296ef1d55d4188ad7d91354e
BLAKE2b-256 b947f4ef2fe7654391c502229024d96dae732672c545f5b09319f98ccd1a712f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8bbef5344c45ccbec11c0af44d20dd8431e40b3bccadf187051c541cfe781931
MD5 80bfe9b1c87aa66c15921f10481e2564
BLAKE2b-256 7ae19102803fc78e75de425639f8a36547e32f1d564320bb34bc622b0375ef34

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b5-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.5b5-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 21a803abe3220d8c355da763ca36f1300e09ad53edbe6ac78aa935f447985c9e
MD5 2584ee7bde8ec365eedb14998d050488
BLAKE2b-256 dfe9f48f2f1faeef87b016201f26c8e3852155859c8e5cb1b0be803cf1a840af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b5-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 a351b7cd60c47d8bfb822d622068fa5bde01440b446669b76a79171dc3453a28
MD5 fea3b897df1eda9a51d39db8d153d09f
BLAKE2b-256 dc5df55a6fbc085e613785617f9a9778b30bee0b71f8bdbd5e24da6d5111e305

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for vpython-7.6.5b5-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 14c3c94a587d0662fb8ecb3118d83dc7b017f53bb9b83b08b00ded17864da85f
MD5 37e990ed5049551741cef1f9d3425683
BLAKE2b-256 86cb10321b549014b6bf73c16ba913cf3825a44dd541f75cf8bb2213cd2e095d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 74b6a8ab8c052711f59e45567840ec5780f1966271735ab4db226de22bb2993e
MD5 cf76abf4fa7b65d29bfc9797c69cb704
BLAKE2b-256 9137dad6c07b73a9dfed8a37875338bc3eaffc791251404637d671c98e015154

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b5-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.5b5-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 622ea06cafba63473716ae1e95b6a5be1c9d55dc882cb7c26ca816e81a944057
MD5 7c2069851dc753d9fd728449ec3a44ab
BLAKE2b-256 daf70d246c786ec9dcf090714bba2177f0bdcadb95ec973bb675f38c47efa959

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b5-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 fdf2e2cdfb8597b0729e11f1077f63e649d7d904a0a02cdc9548e1f6f8d8c4a4
MD5 173f56cd0491e762c4d1ee7e875746db
BLAKE2b-256 47cd82c6f32453cb8c8da7c0174f54c829633181ed73038a9f3b213b084f95b9

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