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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ x86-64

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

Uploaded CPython 3.9Windows x86-64

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

Uploaded CPython 3.9macOS 11.0+ x86-64

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

Uploaded CPython 3.8Windows x86-64

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

File metadata

  • Download URL: vpython-7.6.5b6.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.5b6.tar.gz
Algorithm Hash digest
SHA256 d0d5248f5d3e2ef347295d9c030fa25d8eb1b598a649a8b1ec04c4691eb29415
MD5 833a8fd6d4bd739a6216bd38c50f4c08
BLAKE2b-256 a5a2fbd42ab64198ca84c8897dae864390c425c3d04dc542f103c0499087ad6f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.5b6-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.5b6-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e87cab225c32d3ec0a97f9a718d44bc36c94afa1a88e67d33481fedb21e842f6
MD5 586e3b38f96f982bcac4cf08a8933fab
BLAKE2b-256 be04be51573fd41e8d3a1ac053fdf9a72b65b3eb4d3aadc8eec087afe40418fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b6-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c66901e2f648cb01e83ab29407d71c5fcf8e370eeb5fd076e9bd13ee757566d9
MD5 79d6d1607c181ede04cc811e78095cf4
BLAKE2b-256 113a18aee4fac65d8cd1be2dc60ad8430f1955f0044bdcbea456de377ae90c58

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b6-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.5b6-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 501b7ceaddb557e0ce073ed2f625faedba295c6695765b64c33744262c77c8eb
MD5 4143b0914fee1221f78a0968ccd79d9a
BLAKE2b-256 c9211652117c2458ab248078d93a8e6fc5c5d1ddfb421ee5b7aa87989e56883f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b6-cp312-cp312-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 2170de76b106b949b8570d6c67684d9fc447e766cb2492fa3ff770514e716ca6
MD5 449c1046d1ec30223494ef3a37fd376f
BLAKE2b-256 010cdf3c6e3cf015db91c12c141d866b438ddf2043f4a14b3ff37770ce41b2a0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.5b6-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.5b6-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5c3ed702be3850db883475a834a8c49efa804d6e2bf0df748560f4e674a54127
MD5 640053c2ad41a7033ae27b2c13567279
BLAKE2b-256 21d9eb176ae9ea7f1d5288b04cf8ff22656dd6a2c0894f775c0b74b5259b74cf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b6-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a70323520ccf831cad8a88c4b1212d9a6c9c79f8bb00fd8287c5ffae3788aecc
MD5 3b9c9c508dca2d6ceeff2d3a6e7fbbc6
BLAKE2b-256 a8831fd389ffc8a0e2d54bf3131dfd6fa6404c90ab8f6585f742860750c60166

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b6-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.5b6-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9f522d6d2d436e3830d4368fb0a48744f65087ddfef77ea1c7c791099e719d30
MD5 12202a5bd05fb084a0d27e7b04b333cd
BLAKE2b-256 48bff70adec3bab7d930f75d1189c30f3598d9deb0d04ef5e34f90c36186a9b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b6-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 cf3b186afd6eaac242b07281f5ddfb209b0f64446fa04c17dd7eccdcb5ac9d00
MD5 2743f42f662bba3c3f3dd9a1687cfc54
BLAKE2b-256 0be2a024f489c98f0c09193de89a967a4939943764229cd7ce4328fe77c33970

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.5b6-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.5b6-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4204dcd350baefdb951bdfd2cb947ca8a438457209ca720210ce590e8a75cb76
MD5 1568ad0c273539d650b157525287f90a
BLAKE2b-256 28309c7dbf5c6d002bf4ca8e43f171d09c4a5e496c980525ef681879ffabda58

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b6-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1725bf0e93667581af4eabe59aaf18fd970357f79e82992c9a93809639185910
MD5 ae58501a7f062958648dd7712e042e72
BLAKE2b-256 4c744f469645e99523af0c1413454fb0a9b10e088c47cbd5917e60e3339d4e5d

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b6-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.5b6-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 68e0ab32e68dacfd4a161cb08292fa33e81c61fc9f8483af9436d9156501e062
MD5 1edd04e97b48df0576a9c50d9349500d
BLAKE2b-256 aae45c37dda41ccd3cdbba0437079abbcc9fd245959cecd74dc67544f83ad119

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b6-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 2757f36cbceab9ad2128c24a693ffbe47c2964a5ddcdaed67138186285f23c75
MD5 80b70820b52dbaec6f7c84b70cfd7527
BLAKE2b-256 6fc43aa441775d73805b822066d693a601990c554da3bbf7d34be0d06e8bb271

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.5b6-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.5b6-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 af510969fb61128b2748d6e4cdcaf4953d3b40220c12aa75f19b2eaad9973f3f
MD5 41c7a71d5df5190f4b493c7c88e82159
BLAKE2b-256 bd6e632d676236a4d5f67cb05fcddcb078d5cfb97d968ad55b44754450aff805

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b6-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ac44e88b915360b94f63b667b2072346ea771d1861f2c03dd11c9209a0d55828
MD5 c249055eae8431c7b145a600ff9b40bc
BLAKE2b-256 289faa0d13877a06741c42b80f5cc3873e88091fdd0abba6da4bddc9ccd6d6d5

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b6-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.5b6-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 98536c6483d71c81cc2cfba242f5d88e5adb93ff61cc2a23d8f4219798d5a238
MD5 07c7adc00816c5c015b01c606b8bc7ee
BLAKE2b-256 a34222e70af10b5a37361f6223970e7af6c92ea5e0cf9484380cd4d95159b9ff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b6-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 439bcff035e933b6ea20ec639794f072953c021876a0f2952fb2bc4f94505cef
MD5 ce791c5ffd07a1428ad4939c7cf0ddb7
BLAKE2b-256 31d695e0250ad040d15a8cf3db8880155c3c6ed879f3b2b58c81a224219083b1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vpython-7.6.5b6-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.5b6-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 507db6bb4deb6d8a0abe4570263575312e2952e7194bbec44d977f99f4079122
MD5 f3685880f77b8dcd0d86302daff834e9
BLAKE2b-256 078b7c8ba6caa4373dbfca9e008adecbbf5b9debda7e501249d8c0b2f97c1035

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b6-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4190062ee9bb00a82d914166cb24872c185b37a59897c994417491546bb80ac7
MD5 4f6b36a3170e6769772882ee49642269
BLAKE2b-256 0d4da7d4a0b9113bdd79a93a31f68833d10d7635de29735d15aa19fe5952a9cf

See more details on using hashes here.

File details

Details for the file vpython-7.6.5b6-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.5b6-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dd13477dea02e9c5847e34a80be8af837e5a29570124bbb64c802b794976a590
MD5 4d633b89e1b3c0d2eb810e861189cade
BLAKE2b-256 b6cc060593e81284b1902b44ef797f4ec06b2ef685db0e815a094bd31fc5c915

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vpython-7.6.5b6-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 a6197d766fbd7090ff1f6649f4e1c6a1037ca8904e77b68ea36b640419221a73
MD5 5a699197aaf96a9bbeeb05a64fa0fa85
BLAKE2b-256 b6c06bbadae2d2abacc5fd4b61dbd46808127b3cb75a3af065c4bc0d031102a1

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