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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ x86-64

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

Uploaded CPython 3.9Windows x86-64

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

Uploaded CPython 3.9macOS 11.0+ x86-64

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

Uploaded CPython 3.8Windows x86-64

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

File metadata

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

File hashes

Hashes for vpython-7.6.5b2.tar.gz
Algorithm Hash digest
SHA256 d882153d76efd0e39d8f8999f64f9204f256afe6ac5cb8620d42b7381f76c9b0
MD5 fd78e98ddfa48524beef6c6930eb0e13
BLAKE2b-256 10c0aa5feacee21cf7973b316b78e5c72b09362d30fef0c89f83e24998f94562

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.5b2-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/4.0.2 CPython/3.12.1

File hashes

Hashes for vpython-7.6.5b2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 6b66b717cad775cc6cc444cb746cacc0ab38f7d53c600a22eeca41440211e2c7
MD5 366f985bb5f2cc3745570104f57b3aca
BLAKE2b-256 5fb3ca00fd88da2ddab6c0b6adbc2cd9c482de263748f10a0ace5c03e4587469

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3cf17c481f8f39d02418e61f12533756c58f4f9201ebc2aa71fdc95c7e5916ac
MD5 18279adf88a38964d0b0223a1f93112e
BLAKE2b-256 5699aebd1836b818c94ff7b32ff3b33181fab059c2dc1543c23c86f4e73764f6

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b2-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.5b2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ad9091f765946fb8cce6b411b5466af6168d42171cd3e07510fe3d426defa46c
MD5 faf531169a1150fe11db74b26f0927ee
BLAKE2b-256 ec870575ea71c80d9e669855ab24a285cbb305129ebc17cacb4b60c675e93361

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b2-cp312-cp312-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 148fc2d11bf2136ff3768ab1977e139f0f9c869d28b50010914efc28aa7650c1
MD5 fb5f81f86cc5a710f0e410ba89ed35c3
BLAKE2b-256 7f5621c26dafca6dcdbf67019d97ac573785939e401ca585323c9e2a3a0b6150

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.5b2-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/4.0.2 CPython/3.11.7

File hashes

Hashes for vpython-7.6.5b2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 710842aca65aefa1acb06d979621bccf43682a43085c2c5c3326ba79ff604e28
MD5 6cc2abcccaa44de9d9129f675406c45d
BLAKE2b-256 fd0fbb606ba921b6dcaa0014fed7de02a13efd31ea17cdc6909db7735a7d7ec8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0c24599b768094aa16727bfb01c87c46190a1aedbb7b01196a82d59e5f9d2adb
MD5 f6801fb08e7f823e4e37901d782b2d44
BLAKE2b-256 6e74516003207db504f8702912bf4c17639d87fa7ee0a5ea5e3971dfe55da785

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b2-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.5b2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 114dc90fb36012cebd56a2a2159841f187842b55fdeac0516e4c72e0ccd187c4
MD5 999f3f9166c1a24e4973670574b473e9
BLAKE2b-256 645e0a0e0804fc3d0c665d0145aa97208994f8ea6f6edb89a44a074a3d066627

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b2-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 a68235e688c6007ebbe8cc214e67ab4838fcd56ea89fd4bd40d3f3ff04f92e6c
MD5 d5e308aeeef5d89d7142376d4a3722ee
BLAKE2b-256 71aab272d27d2f988004f4c9830b8dd249619f4230b66b161339483d4391b034

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for vpython-7.6.5b2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7a4741aa9b184eee30a306f42b74eefc38c483b1235304b958cca50bd7e19673
MD5 3ac3459f6a13f69776cfbb5960766e42
BLAKE2b-256 ec5a6c5a48335f5bc5a670f3306665beb8d9680b401ece957153c3d81d0bd298

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 cbd01dcfb556779cec7050ad604dddf8086ee1b5c36e4c844201258f3706e0f4
MD5 e05318c67234350e0974d9a1f269ec60
BLAKE2b-256 49879a8b440bd978df2893b1460e25e5c1a0af64ce3fe821a5c749cc1c0c2517

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b2-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.5b2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 890ed891f4748e8e17b27c69907f6e0c0be8c58c0e42f6189789097fe279b63e
MD5 079775ca3a1266fcea0f8cf0f3341c78
BLAKE2b-256 4c033c3a8cff5d554cf9526cfbbf9ecf5961fd61329f274f37ce2a5ec88f3062

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b2-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 5840c099edffc6d4b9d8b573e7a6d8da7a0237e1e392d2456a65e547255c62e0
MD5 7b4d1d84777d702478f4c281c8bcc7bb
BLAKE2b-256 587dde9ea60aaf253afb6c0a41256b333d6cc722bc65ac78b089024a2cbd081c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for vpython-7.6.5b2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 087fb5b9a1169c9906d82dd39b4277d2411359ffe81e3619b302c28e4da0e292
MD5 62ebb33f719bd640f95af5742ab38854
BLAKE2b-256 60cc92503e2318eadd1d4108db6560c199f77188bee38ca37e3e9732a5f8fe8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 259df7ec6d11b5db10613f6dfd3e17b8112f546cf67f6bdc931df7f50c8c9a63
MD5 2d596ab4c233074c3584a69af13aafe6
BLAKE2b-256 79d990583faab6b7d2c9ddb8cb3ed4be283a9bed03d1c1bd29af57a041a6c4e2

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b2-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.5b2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 962d034ded3b4518cca1348989a30853a25981c79d46770e5df0e1b5cf0e2609
MD5 5735d64b7c327b4733710b9921058b52
BLAKE2b-256 f3df5a9f8a068d0eb1f49c4db1def32cf3a1f16531ebbdb75d79101d85a594ba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b2-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 c91fbdd3996b7b9f389bdc0dd37965d0cb00b4e4478ae17daa11cdcdca8481a8
MD5 7bdb081041062b2edb1d517f43260696
BLAKE2b-256 819945de9196d9e1b7976e6ec863831def1c33781170a845c30fe3fae57303a9

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for vpython-7.6.5b2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 44caf92026936cd2b89468686dcc3bf4c26c92100177e0c395d3ab42ac3e19aa
MD5 2caaf8fb64d9448acdc970423f2a5522
BLAKE2b-256 66790ab0d27c319e03c64e555c05eeaa172c2aebed9adef3cea5686baa48f7a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6cea994d1a1ac1cd4e6798bbdf7dd542745a0b6518ccd018566c84569bafb04a
MD5 65e6cc294955091ccee7ed4426d2e2b7
BLAKE2b-256 981809b451890f780f5431ae0805ca52ff9bf786476b266aa50e3031d0fc396c

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b2-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.5b2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b0ce4f22320f16ecf6425ba82d34086ebb114a3028238d5daa5437b944f48039
MD5 39ae95929e5b578d25e762363e9fb593
BLAKE2b-256 2de2b0680d77c0b3e619bdeb5b321cf4376240fcb1dee896aaaf0e538c221b47

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b2-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 21d931b59e2ac9bca821d9ce39f2bc99b196d97ba61fc136a82fa44312882cc2
MD5 f4a2fce1384f1e7b9af671802f56c90c
BLAKE2b-256 6430d436f0332fdb2d86ff32d3191264c77bface3b41534c0eaa66211705e62b

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