I'm the lead developer of VPython, a Python module that makes it easy rather than impossibly difficult to write Python programs that generate navigable real-time 3D animations. For an example, click
tinyurl.com/vporbit to see a binary-star animation. After playing with the camera controls, click "View this program" to see the amazingly short Python program. This is all at
glowscript.org, where Python code is transpiled in the browser by RapydScript-NG, which produces efficient JavaScript and, except for pretty esoteric cases, does a good job of obeying Python syntax. Most Python-to-JavaScript transpilers produce very slow JavaScript, but these "GlowScript VPython" programs run several times faster than with installed Python.
This pure-browser version of VPython is an excellent environment for beginning programmers, and there are 90,000 user accounts at
glowscript.org. The majority of these accounts are students in intro physics courses where computational modeling is taught. The big advantage is that these students don't need to know how to wrestle with installers, nor do they need to know about folders and files and file extensions, all of which are surprisingly serious barriers to these students. As the user types, the program is autosaved to the cloud. The limitation is that, GlowScript VPython being essentially a thin wrapper around JavaScript, one cannot import Python modules, though this is not a serious issue in an intro physics course.
There is also a vpython module for use with installed Python (
vpython.org). The syntax is the same as with GlowScript VPython, but of course it permits access to all Python modules and so is the right choice for more advanced courses. It runs in Jupyter notebook and Jupyter lab as well as with other launchers such as spyder or IDLE.
In all of these cases the 3D graphics are produced with the GPU-based WebGL 3D graphics library that is built into browsers. In the case of the vpython module used with installed Python, the Python API is written in Python, which contains local server capabilities to communicate with a browser that accesses the Glowscript library. Here are a short and a long presentation on the architecture of the several flavors of VPython:
Obviously it would be much better if
glowscript.org used real Python, not Python transpiled to JavaScript. I totally agree with the notion that Python really MUST run in browsers. My question is this: What would I have to learn and do to get VPython running in Iodide? Or to put it another way, is there someone knowledgeable with Iodide who would be interested in getting VPython to run there?
You can see lots of examples of VPython by going to
glowscript.org and clicking "Example programs". Click "Help" to see the documentation. Be aware that VPython's support for vector operations includes operator overloading even in the browser so that vectors can be added and subtracted, etc. Also, in the transpiling to JavaScript I insert async and await as needed, which makes possible infinite loops and pauses in a browser environment.
Bruce