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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.12 Windows x86-64

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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.8 Windows x86-64

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

File metadata

  • Download URL: vpython-7.6.5.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.5.tar.gz
Algorithm Hash digest
SHA256 26d0fe4c4f253c36a570ade3924cee2423b2feb5e6082ff5d5f2eac093e746df
MD5 14f7cfbb121718378d16ef7ee2aec43d
BLAKE2b-256 1d39451ed3e42c1b576b056773b879e4546381cab5963aa9a7539d331d70a31d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.5-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.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 023b8063a2a0e3f2911ce670cb0799a95234da3a551a0284348e8bb2f96a88ff
MD5 68f9b777591e88dac17edf0503adb98e
BLAKE2b-256 4b580ea5740f7c8a44a7b97e7a485677cdf1c6565a6477c780d5daca9eb75af2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 effa304e7bcee868e30e201100d6b4c6fd100d86421d8a0e1d6b8a0ba963cd4a
MD5 a82ab5b1f1f03f8ea614c0e11a34d957
BLAKE2b-256 ef32a9aafe666c7c2c8edfb02e262c34b40f860e31fe0a6eaa7f5c420ef1b874

See more details on using hashes here.

File details

Details for the file vpython-7.6.5-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.5-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 96211a39dfcb4e8aec0152a7c0c3bfbaf6bdec8b7b89153c8a889f138d7e97c6
MD5 90ce06f252826a67de2db1215653b739
BLAKE2b-256 b2e0e63ccacc3f70a2345f0999b208d7c367e2fc70cead2e5e7f14eb8649488d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5-cp312-cp312-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 6afcb7bd6b590a26317dd39b0cef3fc8a30129afaa0016aea3da99bc3b879001
MD5 e67a6495bb8f7898333c87e6815f6992
BLAKE2b-256 4656c37b434e0dab53a023eea461c98710f4795ca227db0b501aeb1d0a246432

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.5-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.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5d5aa2836655e2433bbefd7e88a9138b8982a5dea470cf479ddff12b44ec8230
MD5 ecc71561f0999c8959b168e278d50479
BLAKE2b-256 592876538eb8de6dcb2c1e8c91dd101539f3637b418160be53b4950c02d540af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f121840dee69a1066efa33036f7d2f5efae5f0084c6ed59f587301b220c2eab7
MD5 aaf0de6c01abd1a001ed593ebbccf3b0
BLAKE2b-256 e88f447c17a8968a8a0b4c52fe0ad24c4bdb39c18a73d940105f8669a87afe79

See more details on using hashes here.

File details

Details for the file vpython-7.6.5-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.5-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 22b98eb35d9fef8b43582680a80af40f357a6df760dd2b1d774383fb6641d3aa
MD5 9377a487ec6f442229b2c818ccaabdd8
BLAKE2b-256 a19a7e5857b9c248e9bdb9c824cc11cccd74d6abcd12998a3dbdbca3e67e6601

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 ad3ae1093b36c9a8da090b9596d86183d48edc6ba401292bca327a314b08fe19
MD5 fb657b4338513696247bca4bf0b07511
BLAKE2b-256 5c15567c656b529fe9dd8ee125d9b97611929b2b79d411b2a261e084b792f023

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.5-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.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4e29b832565559a14a4b539a8e412d56051c360f84cbc60332b7b96f1454c6e3
MD5 6bea4faf7e1bae714510d26b8c822ddd
BLAKE2b-256 c0f685173f7e2463c8fa7ba09f19a5d8df5b4131d98e5d6e84062e796146d376

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 47d1a792b49824c47082717ddc13277c426f2984847a03a117065e3b70ec28cf
MD5 3a6d53da9d447d97458030d304417873
BLAKE2b-256 842cbdbc28bb184cd32340c80ac1618ce5cfac0b6df70df28f0e4942b5992964

See more details on using hashes here.

File details

Details for the file vpython-7.6.5-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.5-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d1551ad0b8ce2b60099ff5ddf61ff2ceaf9c344876bf6a293f533b1dd979e434
MD5 8ba242a7f3c1569d2df14e42032f2ab3
BLAKE2b-256 e288ec77332d6e83470b2fab185e58d1b63990e88a4230695cdecf545e25104b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 48893eb486ca733e51ae736f6d72cb4473b145f7ce1c9dc6dcab545d560687b2
MD5 71abb647c5e442281fceb0a1c6580797
BLAKE2b-256 e6100c509d09666ddb699af57c72d58c13a20cebeb042107cc18a4ccf92da98c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.5-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.5-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 5721400c2859e1593e1e9266b987fd54c9e5e35dc036a182fbc7c96503dea172
MD5 a02a980845068fd24560c45a4d3151f7
BLAKE2b-256 058893c3c2a30b4c59d5d1f3dffdd4d1e4fe4e536d9cdcd43ac0d2f62be900d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9354db9ae6e85d35b70b4e1b1770dca5cdb6e3756c98dd82e87cee4b2e4e2a46
MD5 a0048016325b25c417a73e69b8880332
BLAKE2b-256 8573f055a971e20bb1008866636afbc3994d0fdd4fa793fdda2bf10cdb7c6038

See more details on using hashes here.

File details

Details for the file vpython-7.6.5-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.5-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1e9a04a3a2d193284f4d6581271cce58ff7682b38aedf5fe423ada779065b5b8
MD5 266d654189c9d1b44645c0ef192a5d0e
BLAKE2b-256 8b22ad8276e9b6a63b9bea1bc8ec6ccff7b9d8b006cacc43fdc4a589cf1408db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 50ba5b1d4a144fb457c61b0b106c2df4ede405bc6cd9e915a31bf532698cb186
MD5 bdd3e30b2b5dca8a6aaf407a41f11400
BLAKE2b-256 fabe304bc233d096005178e57a5f6397c3db0aaa84571ef95e60fd3b1504ef88

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.5-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.5-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 2dd636f8eb17e497d531831f172eb716b8f526277b9664618ac180b3f7f63a7d
MD5 fc3494da27927273b0a0cbb9978a1911
BLAKE2b-256 6461e9309691d955d5b994eff679709de9647ab0dcc44608dc373b656a82d064

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8d1d3e27dc613bc2695ab0d963da68aa4f90a12d6f526460b5ca0a14b76fe049
MD5 38d942db1c779f3fa647932952513a75
BLAKE2b-256 89526091d15f54f95d771eb010756c5e9c417412e27a00916d6ac889cb61b613

See more details on using hashes here.

File details

Details for the file vpython-7.6.5-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.5-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5c27393d968115174a614f63026ac7253339db1e28630a63120b8813ab5c2fb7
MD5 18ad4011564e2dd562621d70864e431b
BLAKE2b-256 53d4019667a477f5dfb88d2815bac853bbd9d6255a1c274e6769851ef994d492

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 ad3c24c784219af51a46cad580da722bfe300e872391974a30577dd61decf43b
MD5 023479f3311ea9af0fa455496251d587
BLAKE2b-256 738071847941d2d7ae6b08f99abfe3465f2032d1f7bb710fb4a94af2e760883f

See more details on using hashes here.

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