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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.10Windows x86-64

vpython-7.6.4-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.4-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.4-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.4-cp39-cp39-win_amd64.whl (3.5 MB view details)

Uploaded CPython 3.9Windows x86-64

vpython-7.6.4-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.4-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.4-cp39-cp39-macosx_10_15_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.9macOS 10.15+ x86-64

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

Uploaded CPython 3.8Windows x86-64

vpython-7.6.4-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.4-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.4-cp38-cp38-macosx_10_15_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.8macOS 10.15+ x86-64

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

Uploaded CPython 3.7mWindows x86-64

vpython-7.6.4-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.4-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.4-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.4.tar.gz.

File metadata

  • Download URL: vpython-7.6.4.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.4.tar.gz
Algorithm Hash digest
SHA256 162ed54db313e5f87f9704b13942d3a0c7ad2da88b287d3baeb46e0eba7ffccc
MD5 c974c7e33730b619bc7980c7dc6c1171
BLAKE2b-256 2e3cb3fa3e1a0f75b6db0d8266604e9c8f9bb01481b663bcd3431ce3813a0f9d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.4-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.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7fbf50c25d275438649d3ac95173bacaa522b570e7d394d1b18ddf8512c9d9d6
MD5 4b785a674d349b8f37a724db04a4cf4a
BLAKE2b-256 b2cf03443ae35cce489202717f53d9449c6af4ea4e10adfd315a2b09254a1286

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c8c8cc57dc5716584fcc713ec19f3961be9a69239f351215c86c8530f6110b4c
MD5 5243d14a8f3cd6a7a84c01e5cf368d9a
BLAKE2b-256 605991391594dcc25aadc9d015c4a20eb77cb3b2c1a5d6fcf87a2e8ba0bf7c90

See more details on using hashes here.

File details

Details for the file vpython-7.6.4-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.4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 9a8ea89fe3e29f551eebd3a5ab715f1b225fc3a2cee4e218e64ac4ee26d5547a
MD5 69fe699bb6d05b63b0aef4b9a59a720a
BLAKE2b-256 a7512acb486e3cb02f6f2904c75949081b16256cf912ef0b3d19a4844a0fe7f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.4-cp310-cp310-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 7a38e1aebae1832617a795d50f5c7ad679bd414ec4edc9ffe48dab72af69d940
MD5 2dc6b1441755bb2f37cd64d5cdf6f937
BLAKE2b-256 09d2e56adebbbea4fd9f7cbbe86ba80c5d4c84154d7f3b6798242757aed5f078

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.4-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.4-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 e2ec8744baf33786d546dff20b8b50a7b53c37370e6fc722555b122da8a7684a
MD5 c8f1189e5e361a3da8a342aecc3fe56c
BLAKE2b-256 e7b8c4fcc22241323520129881efeb4ebe8ff89610abedafe7d9c3715150d042

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 19519cda5b073ef58cf28f375d0b078fdfeff18ee50d56fa792047023d88c106
MD5 7b5dc099fcd5c0f49a516d64e7c5ea72
BLAKE2b-256 7a6d3386408b82a275cee3200055a4888bae8585c7f041bef8fb9471c59af5c4

See more details on using hashes here.

File details

Details for the file vpython-7.6.4-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.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 7e8d5f067fb05f84d273860f58f9f13d90000db7ff8a8c3e599f1a4f62299584
MD5 e8caa9a55925168915c07c8f696c2d17
BLAKE2b-256 b9214ca125f28411fad9931222c4c2c312b8de29ca92a94d4233f7cedbc58f13

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.4-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 8820fa26ecbc0f813490430ece063ec20a3fb9fe62f9ccd6a8c05481482427ff
MD5 14d866cf2adbf1c38fa4da139d7b633e
BLAKE2b-256 798d8454c782cff3ac62fedaed23aeecbd6c9b1a30afb104d6ea8adb93d4cc42

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.4-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.4-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 31cbe4809f23881090a42730377c26a3fb81e6dacf03c4a71667d8a2b796ac16
MD5 4bdae81bec25d049eece4e20abb011a7
BLAKE2b-256 d50ac7b3fd92489856459dc5d050c88bace248d089cd0a6ccbf6cc86bd96c3d7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9b4d37609808ef67da0326d8eb5cae7afc45a297eb2017293d49c7b9ab2e4165
MD5 f4da2f652c3b713ed67d5156bb8be56f
BLAKE2b-256 59b8646a1d2ae5eee33a521319db982e5e67d316496ffaa974bbbe66ac0af2e5

See more details on using hashes here.

File details

Details for the file vpython-7.6.4-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.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 913d05caf5eb6db2cf1af3f8b035c3203f55f542d9dac48c5ef1f93ccf5741ce
MD5 190c356d5dcd50896eec280cdab1e4a3
BLAKE2b-256 784b96365460570fd209ddb46bd4268ca7b32b9f43e43613f284852f9fd1a508

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.4-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 ea6cf2608db89efdc9043a77e49b5cec509710d50d8405930ece803a17e02f1d
MD5 1d05a96c85c1f565874c05bed8746004
BLAKE2b-256 a3c83de9d46536e423998313a8043048a62b5c51e61803afec76104ce6d09ab4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.4-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.4-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 89a617306556ea93ffa20e32cf238d3ff4c927cc44890f7d62e6e8ee1b8702f1
MD5 4e3416088618499c528b0aa1cf9c6ac0
BLAKE2b-256 b6d848fab3acf3fe1539788df00724d9998938cca0ea3ecc6511c2098d7fe111

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.4-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 779ef66faf20bb1b485235b75b2937ced995284e50047042ffc4f0fa6754c865
MD5 518294a7183ddc7961f7af908be6875b
BLAKE2b-256 b1aa528cf4763b674fb766e45c2355275d7f48948218b6312ffbddd5ec8fc62c

See more details on using hashes here.

File details

Details for the file vpython-7.6.4-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.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 64592723cd379e72d051f707a5258bd34d322279960d8480412f9f1a4a665bc6
MD5 132f64868ececf22aff9359bd321b552
BLAKE2b-256 fbe9222d89054d5f1fc094f645023296a01746fbd217c90db4823224ade68d93

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.4-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 42f173a0adba758d275ad1adc0d1f6a71f993cb1ee6ee6d4179892632dcc7973
MD5 7c6bd43e3eab67051ce3a612d4da625f
BLAKE2b-256 164fa00a215e44e61908eca9371c352689f69b085188542ab75820dcb8dad58e

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