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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.12 Windows x86-64

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

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

vpython-7.6.5b3-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.12 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

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

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

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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

vpython-7.6.5b3-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.11 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

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

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

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

vpython-7.6.5b3-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.10 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

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

Uploaded CPython 3.10 macOS 11.0+ x86-64

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

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

vpython-7.6.5b3-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.9 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

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

Uploaded CPython 3.9 macOS 11.0+ x86-64

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

vpython-7.6.5b3-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.8 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

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

Uploaded CPython 3.8 macOS 11.0+ x86-64

File details

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

File metadata

  • Download URL: vpython-7.6.5b3.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.5b3.tar.gz
Algorithm Hash digest
SHA256 f411dcd266e80b5f785da28ebdc9b2cea10057434481e0db1d811e32b8d5a33b
MD5 5d98b7e0cfdaca0288124b0e147f5198
BLAKE2b-256 f48fb2fadce8a0ceab1aaafe10f4344815b627a73e9eccc27a109515b4d66fd3

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0ff237f312f546c1a1172814cd0fd71125f6827856ed315b32a4b82006589101
MD5 77f115060d2ab09766c027aee3737b0e
BLAKE2b-256 65acc22adc1e6e27639293a283c51723deff902e47cd5f86270d547b929359ed

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4619b7b462c0489614d3892eb13ac82f530bfb0e53572d54f6f1e1fa703d78d1
MD5 5a205ec360008fbe14d0a14c1eb43df0
BLAKE2b-256 cf8be832cc35f336ca18596f26cd24975894da174b11a4f527ce2e2ffa991255

See more details on using hashes here.

Provenance

File details

Details for the file vpython-7.6.5b3-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.5b3-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 94e131dbfdca2e318aeaa7ecb6334320aeaf9a25558829326f11b2e957c9d764
MD5 8b29c15c0e6e376d086e44c4380d0782
BLAKE2b-256 b2a6262ff1703f45086a97329ef35fcf9392a39b59f18533138c86818cf53d94

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b3-cp312-cp312-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 99c71ac15145d16d91a6a1370198cd8cb2782b26a668621244d7e5512e4180af
MD5 b985b1fac89ddc67e617c2961dfb1a2e
BLAKE2b-256 b2247222232b1ee80f39d7511ba533f2acaa9a84faf46c9619dfba7c0e0fd1c9

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 6e5f2fd895229cbc707da68f343832f8ee2a01201ffb7960bdc3103306c20a05
MD5 e8ae7e4be6afc9cfcdb2d2475e692155
BLAKE2b-256 1e47b3d17132d23f2ef49554654a783b713ee2bed30feebe801a83da7d95b2f2

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 dadb56b34ca1b69974a57c8c83f73010f32f576ac3ca6f92205d41b2880eeec1
MD5 48b2e75ff5fdb6df2f501ca88c5e1d2c
BLAKE2b-256 cb57de33bcd2b1159eabadc846318088977ca9acada13321490ce68b23704a3c

See more details on using hashes here.

Provenance

File details

Details for the file vpython-7.6.5b3-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.5b3-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 19ecbed9f0f2c44036d926022ae795d7a33eb8e45d42368d25186b78c7df0154
MD5 85a7a304ef3af5b262889d0b326ac0d4
BLAKE2b-256 585bab864b29ca108588d94b658308686cad9c0e331d61f0205b809a8bed75a7

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b3-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 b5e23bb019928279e7589c06eb0bc3d14c3e97199e1933b3e17e3fa22c8c52be
MD5 19013fc2937a2c4730decb8149e4d5b8
BLAKE2b-256 276b5d8b4d4238815b48ac8041b401cc73fe14564d74f4e7475ae8a7ae3bcb26

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 bcd8cdcf9e8a32ce76fc7d459ee560f00bb9960d45689e485af2633158e6f31d
MD5 0703cb474a80f24c2e69c680877473bd
BLAKE2b-256 a8be45eb4463ce70bf9d2062bcdbe5cc947e2ec011a44a913d3c24c35776116e

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 eb4fa3103202e30014f6b9d82af016ecef3e1fe59118edfee42f335ec039e632
MD5 0df1e9642d32ef1db42e26c3669932af
BLAKE2b-256 e5816e87b1676372010f0c9e781b006f4f8297f02d1ec742079d57f3c7c2ef85

See more details on using hashes here.

Provenance

File details

Details for the file vpython-7.6.5b3-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.5b3-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 556e4748f554e4c9b6ff5cea2db1bc5f547c9b958944402afb0e3353ebffc56f
MD5 a6adccb95fb1038a4954802a8d916b9e
BLAKE2b-256 36339f8757979801d151ef19a2bd63986a165bc22116a4da2e45b9de26d282cf

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b3-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 dd110f6cda88d01dfd03d6f4c78526865bba446b98117d777546ece89aad14f1
MD5 3c1e13c4bb9a4accdb2cab5eb1a167da
BLAKE2b-256 e796c0ded74c182e732d0363c9dc2f0f2eef24257700f499cd74b28b36b3e2a1

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: vpython-7.6.5b3-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.5b3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 cc3932729b0cb4a004130aa5ea0af18dd9a20d80b55f3cf63a5bc7cfb4b217f3
MD5 8a44bedfd781f917025e2ee8ac29bc2b
BLAKE2b-256 6a32f0980377f8ff4281b0315582280873d1d1cc2e0269da300a896b7713c72c

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e1ccbb2c02ac0938ea92ddbaae25655946ae8cea5c2c726779e2c785a0117264
MD5 ecfe5caa54742f3893e035a0a0edb318
BLAKE2b-256 391dbdb73a657955d158541abe654e3ebbd352196fb657fb02767a8bcd3b9fef

See more details on using hashes here.

Provenance

File details

Details for the file vpython-7.6.5b3-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.5b3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 88d7f982e29039960aff75d9dbcb14cef45dc32fee3072bfa75ff6178bee4115
MD5 fb77e1b2ed076b5f5bb35cf0da687867
BLAKE2b-256 67ac798c461928914ffeab854d8ed727cda6941cfbba1f4acdb4853af3b05e52

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b3-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 c077477e177ef76ff077adb2751484fc4052aa1252ef1cb4838805fdae67cb9d
MD5 dc3d20d4c093154dddd051fba08cc633
BLAKE2b-256 eb599323097f0281bbcc0fdc286cb6d1fee76e13b9ad86bf8274d760e7d9783b

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: vpython-7.6.5b3-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.5b3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 e24b0fa455d3b7682063082215f3597df9ac1b57d8c54f758fe344b531a687bf
MD5 3e4f10b5114e7360482c754061ab2539
BLAKE2b-256 4f4bb7d3a6a0922df0572014b5870ecf94d1faad195ee23c47d91c08f4c67f01

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2591aa524800577d7108f8de072cd0e3a0c4034389d12c18de48e52c3b35ec17
MD5 b98436686a777df9ad5c63a51d0207ab
BLAKE2b-256 0d87f1c0fc228fbcca3bf599750b91a1369af09ed0f4043ab16c8db19bacc4b6

See more details on using hashes here.

Provenance

File details

Details for the file vpython-7.6.5b3-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.5b3-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 030999de22ad7bbfaa3abaa91aceefdf5fc9e8edc0e81b53c1cae66b09467261
MD5 64b5d557ec33b68c7693b61fd6c243f0
BLAKE2b-256 844cdc8f390e2d282a2d15e367a17fa32fc2fff2607e1c8480d0c63812973b5b

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b3-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 862d477ca23c8597652531b71c9618e54b711b8c1cd9db0fce427fa3fb37418c
MD5 db1bb6baf2d38b56947fc6cd58395abc
BLAKE2b-256 3e285d08ebc7b20363236a458d51c2b513c6cdcfda2dbafd668dbe13415e7891

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page