Focus to graphics directly

32 views
Skip to first unread message

Ying-Jer Kao

unread,
Oct 4, 2016, 10:05:32 AM10/4/16
to VPython-users
One problem I find with Jupyter notebook is that to run the code, one needs to scroll to the code cell and press shift-enter. 

The graphics will be generated below the code cell. The canvas might extend out the current view. It is ok for static objects as I can just scroll down.

However, when running an animation, it can be annoying as by the time I scroll down to the canvas, the simulation might be over. Currently I use separate cells to set up the canvas and run the simulation as a workaround. 

I wonder if it is possible to set focus to the output graphics directly after the code cell is executed?   

Bruce Sherwood

unread,
Oct 4, 2016, 12:56:30 PM10/4/16
to VPython-users
There is indeed some awkwardness in the Jupyter notebook environment. From what you say, it sounds like you have already discovered the following trick: 

There is a way to force the animation to appear near the top of the page, which is to split the program so that the first cell sets up the canvas and the second cell contains the rest of the program. The effect is to display the canvas between the first and second cells.
Reply all
Reply to author
Forward
0 new messages