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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ x86-64

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

Uploaded CPython 3.9Windows x86-64

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

Uploaded CPython 3.9macOS 11.0+ x86-64

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

Uploaded CPython 3.8Windows x86-64

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

File metadata

  • Download URL: vpython-7.6.5b4.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.5b4.tar.gz
Algorithm Hash digest
SHA256 77cde737e06e29309f1efc905fbbce2043c584094bbbe810a25be753330d0c9b
MD5 8fdb4d0053df0f28acef84c1a2a2b881
BLAKE2b-256 5f3dc99411be0e99039ad0d9f9fcbe102e3da1b74e5451aad4f96767c50837dd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.5b4-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.5b4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 896d2524e77eab5a0e9a31a3d97c044b8d45e0bb05c5e26d5205b731cf4f5004
MD5 91c305df7e31b9d3690be452482461df
BLAKE2b-256 13daf0cdbd19b375ef5ab55354f7e00500fe35925c63c048da4c101ab9daf6c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 106eccc293735ccc785e1e1f0cffd2286c4f98a449dd258880922000486a5861
MD5 c8b53bca0b41a5c6f2c5127d6de24409
BLAKE2b-256 07ea9dd11a948d065296f24190db572744344a98a86bbbfe114c1161d8d5533e

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b4-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.5b4-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d7c541d4213f12f3470384bc10aaf76438a17a9a0dd047ac7ccbb6090f2f793e
MD5 fa75030c88d96aa8a4840497388a14b0
BLAKE2b-256 bd473e4030e6ff081b49738549d902831103f4e555cb54493b495c5ff8c11192

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b4-cp312-cp312-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 dd26f589748f88ca113867cee3b5022f27901dea3d63f2bb032d4f7f9d5e2678
MD5 ada5307e52fd4395427a5d612a212ea5
BLAKE2b-256 633a4eb8e143584f7f664156a794b72d034da1633eaeb149bea53c9a2674e61d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.5b4-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.5b4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 ae28202ac1061a95ce1595ba1797849fc18ba024d33e519538c7f44fe918587b
MD5 ccf13a6a625c164fad6d7a4139a5a9aa
BLAKE2b-256 d31d56811f19dbcdf0ee56d0b609ad500b64f127d000f9a309227aedf6d23b27

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7154eaa8ed8dc65803c9a96ca076188633859a41ad466ab96df4737d79940f89
MD5 1179270bc7167f73eadc3a04f40687a0
BLAKE2b-256 862d16b0dd79f072038bd086429d61f34a0e5861a927fe7b71331cf7077ec0dd

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b4-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.5b4-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 44f3a6433d5b3396b92d2310e7cb85dc3329a72e549a61b35aa9a041b99837c5
MD5 3f8486ee3ab9f76f8dce38b97ea5e652
BLAKE2b-256 fa1c27b113a21a6f557d78d5d989ca349c84ca009668ea3fdf29177eb9cec7d7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b4-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 4ac81a6afc5b8de54af37fdd731ebca005f9ac5ba2bf181908fe8e2f22c3c6d6
MD5 1d684c042fd78cc149d689a1f00d41ff
BLAKE2b-256 31af55739d664feefb34744b4865893e6fd737e3fa59896d401e389829ab3313

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.5b4-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.5b4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 07f070b170594cca68686f1c7c7660e4cd4d85cc1fb9f66e31e2d92f295e7ee0
MD5 1cb0ba638669872064e1bf6f0ccca95c
BLAKE2b-256 9f129bc08a8f3e0fa5118061662234692cc41c62cee1c05f1428327ffab38e7f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 35c9dd081ffdd92472032afdeb84195747259bdf6fded3b6c1b9c648992d4b67
MD5 0e3e81ca0dff4be17f0d280a6eaf3937
BLAKE2b-256 7bbad7eb2415dda25a99f3dbc65098893eaa4b06969b173f9709cecfcaa627ff

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b4-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.5b4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ebf4eb705dd76ce6454cc7f45f1e066545ae63e3954862804bee98fdcdb5420a
MD5 0fd2e2680dd64e84b5d419f6356805c7
BLAKE2b-256 745dc666d9ac0fe7ee7267200f20e2450c0d65e27f1c7f6a957ff0cfa2765d86

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b4-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 cec2c91c66e8ba79c710e601bd4e4380711b39b2c284d2f30ec25781e3460e8b
MD5 48470b2af1208702d558256b873440cd
BLAKE2b-256 b6ed446659a36935c955ee636dba96c54c7298f0f41042389786f9c5d9892c85

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.5b4-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.5b4-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 4990fa4bc93868f6cd95d0a4c7bf1ef8f7b1fad008cbd1962bfabe64df326f05
MD5 793ae8492c12c53ae1b9dc5c271797e0
BLAKE2b-256 2cbd56960c420ff03b6452c26acd93bf8db7cf8963e6367a03294179bd35d194

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1c7870141d6dd0dacb456e3fed80425691c20c934b3db895c1a67e3b7ae7bb2a
MD5 3a2915a5947a07031319565c2ab805a9
BLAKE2b-256 c1a00a5979ee27dc61aa4640a59dcafcad15ef3d93525aa7afdd463e2e43ddc2

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b4-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.5b4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 07795e8b7c3e6209a722e19c7fff0d5af8f90cf43ec6076acc1009d91dc6c7ee
MD5 0b3ab8731162ae90ddd43602fe98bda0
BLAKE2b-256 553faac50e75458cafcc198613843bef1100f278f0c69c803c826d8530fc09aa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b4-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 42105da9896cd9b121122253c88695e7d48302098906fd8162e52f5e5ecf7efb
MD5 cf549db2613a4adb4ba6af4e7767bdae
BLAKE2b-256 f9a93b726cc8272858e5a675ab66d9975f6d2782abc46656606ac8784b309183

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.5b4-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.5b4-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 01238310fc07bdeafed5e0effe841c4f8045265f34f98beffd2ef3c357c5bfc7
MD5 169ca5ee75deb2018a26cbe072f90c98
BLAKE2b-256 e8b202da06a8d988e12a949d3223091f6e9fa636d4bb8de39ae8bc6d62939fdd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1b6ed7b613df9cff6bfc06dc76c8465ce5bbcd2ff7f2a4a7134d2270beaa8110
MD5 665ca930e35d2190ba9dc16688f12a4f
BLAKE2b-256 4bd8a78c75e63182a8f1a73a47c1ef969505896574b85072264af89cd7aacef5

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b4-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.5b4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6ef29cda5e0ee743d2dce71639decbe0b67c3a841d6b3c2d33aed34e3242d3ea
MD5 2ff79e8ddc1ea9b34dfa58e8b35074d6
BLAKE2b-256 8c174ebbeba82bf93295adce2a58c1ec34cfe498e8822289d0dc7f3fffcc0828

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b4-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 cf139800a4898f041445cfe7486fe391a3e0cf7b12ffe07c65f3607dac1c1797
MD5 55bb35ef61d073056c2bf2f057d6f8da
BLAKE2b-256 5219457a6fe86a7562c1524f4e522d7d23685106e8940f346dfdedab76f77ead

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