Skip to content

Instantly share code, notes, and snippets.

@fomightez
Last active March 26, 2017 18:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fomightez/b650fdfe175ff7b94acfc804a3bc9f3c to your computer and use it in GitHub Desktop.
Save fomightez/b650fdfe175ff7b94acfc804a3bc9f3c to your computer and use it in GitHub Desktop.
How-to for Launching VPython Binder
  • Go to VPython.org in your browser. The landing page will look like below.

zvpythonDOTorg.png

  • Click on Binder package link on that page. That link is near the very bottom of the part of the page that is showing above; it is just below Demo Programs.

  • A notebook will then launch. (Sometimes first times they hang, just hit reload in your browser.)
    After it loads fully it will look like below with a URL different from what you see but similar.
    zexample_VPython_launch.png

  • Change the address of this page by typing in the URL bar to replace notebooks/index.ipynb at the very end of the long URL with tree and hit return while the cursor is still in the URL bar.
    (Note that for most Jupyter Notebooks you can just click the logo in the upper right and go to dashboard. I don't know why this page is particularly difficult and needs this work around.)

zexample_VPython_launch_editing.png

  • That should bring you to the dashboard that will look like below

zexample_dashboard.png

  • Select New from the right side and then select to open a Python 3 notebook from the drop-down menu.

zpython_choices_list_annotated.png

  • In the notebook that spawns you should probably add the import listed below to your code as this is the only part that doesn't deal with Python 2 vs. Python 3 differences you get automatically when you spawn a VPython notebook.

      from math  import *
    

You are welcome to open a VPython notebook, but this will be Python 2.7 based. So far I have seen no differences in going that route with the code we are using at this time. As described here, the VPython route automatically gives you the following imports, the first one allowing Python 2.7 to run most Python 3.x code.

from __future__ import division, print_function
from math import *
  • Finally, paste the rest of your code below that and you should be all set to run the cell and so you can hit shift-enter to run it. Alternatively, click on the "Play" button [►|] on the toolbar just above the notebook or select Cells > Run in the notebook menu.

  • If you see a note about WebGL not working in your browser and are using Chrome, try activating graphics acceleration under advanced settings ( Menu > Settings > Show Advanced Settings > System menu), as instructed here. You'll need to restart the browser after this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment