I want to build physics simulations using VPython. Although, VPython works great on websites like trinket.io, I'd like to use a nicer IDE than the web one, and I'd like to use real python modules as well as external libraries like numpy.
I followed the instructions at https://vpython.org/presentation2018/install.html to install VPython locally. I used the command pip install vpython
(not really a fan of conda
) and wrote this simple demo program:
from vpython import sphere
sphere()
When I ran this from the command line, the program indeed worked: a browser window opened displaying the sphere. However, there are several issues with this setup:
- When looking at the console, it keeps throwing a weird error
RuntimeError: can't register atexit after shutdown
. However, it still seems to run fine. - I couldn't find a way to nicely stop the simulation. Closing the browser tab doesn't exit the program. Pressing
Ctrl+C
also doesn't do anything useful. The only way to stop it is to useCtrl+Break
, which is a really dirty way, in my opinion. I tried to usestop_server
as documented in that link, but no result.
Is there a way to fix these issues or maybe a different environment that will answer my needs? I really want to be able to use built-in python modules and external libraries like numpy but it seems impossible at the moment.