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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ x86-64

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

Uploaded CPython 3.9Windows x86-64

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

Uploaded CPython 3.9macOS 11.0+ x86-64

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

Uploaded CPython 3.8Windows x86-64

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

File metadata

  • Download URL: vpython-7.6.5b7.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.5b7.tar.gz
Algorithm Hash digest
SHA256 c2b9ee2295f8dee71b41268cba5f7d64b1439e257a73e14c98fd334be4fb30a7
MD5 03f58313e26e989ff0bf92b82e1255f7
BLAKE2b-256 4cf0ead7304872d1fa392341c0039f5cadfaf91aff425e1a5ac3bc1a9e4e37c1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.5b7-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.5b7-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 eeccf6b40d846852b870ef6aa0e165339f65282c063d7bce7899999467b1ab70
MD5 0a9294a3b7ce0a9fce70abf949632569
BLAKE2b-256 1e77bb7dbe5e329d20ed98eb5b26110fab30a18f3dc3abed42fe67f61c361cf9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b7-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 993af36e75243637912a3d7fcad0fb2b15448adbf220c378f9b1b1bcd706aa4b
MD5 d0899df282c83f0030f62d8c87a14940
BLAKE2b-256 f93e2e15d4887019de71de1f89f58658a7f1d94a30109834a6023dcb6b72c8d4

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b7-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.5b7-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8dbc368e889f1846870a5ecf177b0ac47cb24622ae4bd1281faec26d437c20b9
MD5 42e075720901f65e3569599b05fd28f5
BLAKE2b-256 5c19c3b790aa5409bcce43a6fb4eeb2124779208f9791a5abaee4b119079c021

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b7-cp312-cp312-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 9b6e620aff1de861a0e62be76b3abfd5da8bb501480c5300f9a556f1c19361cb
MD5 064fddd1409e730cf50896a4642d91c8
BLAKE2b-256 14029b92fe389b490f05d50a29dd656b14891d7c48b654fdae04600d52d86990

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.5b7-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.5b7-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 18803b3f206e0a406d5a959213acf9b6bb3f089a1c045e48d3cf1eb7d655c008
MD5 cbaf0ff57ee22ad634782ca0d2f53180
BLAKE2b-256 308fee1c76da112ca90875598bbc59bf0fa2f0329b4fa7cca5f87244a3ab8167

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b7-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1819a47963e1207dee39bdce777ce9205ff47a9eacd4cdf1d3318e103777d1b8
MD5 61b71107bc2ba8afd3932e4f295dd5b7
BLAKE2b-256 2c9e058f91e71e8e7333cb87dc60a2c58761bf19fe53b389a17e583caf8bbe79

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b7-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.5b7-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4e1c748a4dec2f01fcdc018060c4eefea2eb1614a27d769eb37ced32828e7f6f
MD5 74c6610f0d181ca139297c2079ca5f93
BLAKE2b-256 09acd23ee77435d39ebae731064c99bbb9c372600348f6fe562e190fd2477190

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b7-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 6df139bdfb6cd4c0453b3603ab2cd2649dc6ed622ed269b1caa47cfc9c898e9d
MD5 cfcfaad3a1bbe77c6881a620bc38a3fe
BLAKE2b-256 b1c71100b074f55764b47bafeb13f026cf618ba6adb5d7cd20096f27728fa93d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.5b7-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.5b7-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 fd218bd4ff48108b9fef327b7005b5aab4d4bffaf8d8b2ad19bb094c7ecc3f6e
MD5 828e4db733a5398bb80461754fda8e54
BLAKE2b-256 7a3f3375bbf240fb984486b9150daad4d080ab300f131ca2512bd39b33bac21f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b7-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 11c579fe66bb8956766b790306c0586f1541d8d2ae1067532ebe90019692b3d3
MD5 29d7fd6fe0b73e7db80a40f13e2466b2
BLAKE2b-256 8b09b424ef3d47b8e49d747402100d42857ea4bcbc9496c36a9df518d968144e

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b7-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.5b7-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 eaf9f85ad8d9aee75c80ed426a303a7b49d9322601ed32966ebbc919b9833676
MD5 afd2eb6fe36677657a327d191e301d0d
BLAKE2b-256 7d46049d697d30936d0bbf374bb7e4205bfba26f28f60b877a75044b92ac81f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b7-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 4dd3dde4cd1bbc6e25a82bae331138b755a1b33762854313941f8cb48e4a6d6c
MD5 a053ec7a8708f6698b3ef4edd321b571
BLAKE2b-256 0e4647784516ae5896243861241f32cd1e235410e08b5f99dbffe38114442704

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.5b7-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.5b7-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 e54a2668a2b3a457c53f31b93db14ea2f23ca01264df4b288f8eb84f4f3d29cb
MD5 a0a3ab4aa04257242a4eb7308d50e7f2
BLAKE2b-256 ff799ad64f7db814effbe000827dff4285895c06c3ce3e525aeda8c918f422f0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b7-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 25d5a1cfa10487096014f1d0957bf2f366e39da6e6926947a5d7d7e622623d22
MD5 e818070e12a6f1fe84ee3d5e9d37dc34
BLAKE2b-256 077705dc8ba1238d2e86eafa875fe400cd46f5ebcc9a1f7c353919105b715821

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b7-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.5b7-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9c9ac3089247adc76b3901445d9dc39d6322356f307061b2e197db8ad7c93574
MD5 2cf0f26164b89eeae082f3f75f66b3ea
BLAKE2b-256 d220acd838708547f24238805f6d8d12cc30bdd34a6706738c2bde88ae3597de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b7-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 4748fef064f83eeb54d103f56f6b085895a9eabdeffe013bb7ae793c072c34ed
MD5 f7677476b137a1b70469e8c92343dea6
BLAKE2b-256 a9eab4a224b4579db5bf92232cdc647b334d9584aab433453d3e34a42cb7cc4b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.5b7-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.5b7-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 9019e3aad784f0020c4793c386d3b075d10c255c06619978dbd356e782b6f88b
MD5 8a5af1dceeb43b6f2775bd88baa379bb
BLAKE2b-256 81aa2c8bcbdecf7acd01d8066220abe8032a3e7c81e4fedb9916e230614969eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b7-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1fc9aa63736d4ca56e6333a593c17a873d745890054e7c8882fd96d380caf1d6
MD5 c552c661a24fba722601b5eaac0dae9d
BLAKE2b-256 631eb8b201098fe26a1eecc687991b29dc779397df356a4d479670519548af89

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b7-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.5b7-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1b1e8780dac94e512606d42df18f421f81fffa22ac7e3bbe283af0cc73b6b0a0
MD5 19c05732ad41a5143015813c066fbafe
BLAKE2b-256 31dcfb9021cc0076552d7aea479dee5111e4fe4fb6971ffe451c045f10a7b3b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b7-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 b0f086711d62b8310130cec0298485ced771d4bb0611ba35cf164bfd58991f0f
MD5 d6dfd6aad8c5e1a59bfa0e62bf71d566
BLAKE2b-256 428815eb2d748bdbb49b6bd571e0652e73b6cb497186b57061827a325852f0e8

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