<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Screenshots and Movies with WebGL
One can use the REBOUND WebGL ipython widget to capture screenshots of a simualtion. These screenshots can then be easily compiled into a movie.
The widget is using the ipywidgets package which needs to be installed and enabled. More information on this can be found in the ipywidgets documentation at https
Step1:  You can now drag the widget with your mouse or touchpad to look at the simulation from a different angle. Keep the shift key pressed while you drag to zoom in or out.
To take a single screenshot, all you have to do is call the takeScreenshot function of the widget.
Step2:  You will see that there is now a file screenshot00000.png in the current directory. It shows the same view as the WebGL widget in the notebook. To get a larger image, increase the size of the widget (see the documentation for the widget for all possible options). 
We could now rotate the widget or integrate the simulation. If we then execute the same command takeScreenshot command again, we will get another file screenshot00001.png. 
Consider the following code
Step3:  This will not produce the desired outcome (in fact it will through an expection). The reason is complex. In short, ipywidgets provides no blocking calls to wait for updates of a widget because the widget updates make use of the ipython event loop which does not get run during an execution of a cell.
Thus, to capture multiple screenshots at different times, one either needs to take one screenshot per cell, or use the following more convenient way
<ASSISTANT_TASK:>
Python Code:
import rebound
sim = rebound.Simulation()
sim.add(m=1) # add a star
for i in range(10):
    sim.add(m=1e-3,a=0.4+0.1*i,inc=0.03*i,omega=5.*i) # Jupiter mass planets on close orbits
sim.move_to_com() # Move to the centre of mass frame
w = sim.getWidget()
w
Explanation: Screenshots and Movies with WebGL
One can use the REBOUND WebGL ipython widget to capture screenshots of a simualtion. These screenshots can then be easily compiled into a movie.
The widget is using the ipywidgets package which needs to be installed and enabled. More information on this can be found in the ipywidgets documentation at https://ipywidgets.readthedocs.io/en/latest/user_install.html. You also need a browser and a graphics card that supports WebGL.
Note that this is a new feature and might not work an all systems. We've tested it on python 3.5.2.
Let's first create a simulation and display it using the REBOUND WebGL widget.
End of explanation
w.takeScreenshot()
Explanation: You can now drag the widget with your mouse or touchpad to look at the simulation from a different angle. Keep the shift key pressed while you drag to zoom in or out.
To take a single screenshot, all you have to do is call the takeScreenshot function of the widget.
End of explanation
# w.takeScreenshot()
# sim.integrate(10)
# w.takeScreenshot()
Explanation: You will see that there is now a file screenshot00000.png in the current directory. It shows the same view as the WebGL widget in the notebook. To get a larger image, increase the size of the widget (see the documentation for the widget for all possible options). 
We could now rotate the widget or integrate the simulation. If we then execute the same command takeScreenshot command again, we will get another file screenshot00001.png. 
Consider the following code:
End of explanation
times = [0,10,100]
w.takeScreenshot(times)
Explanation: This will not produce the desired outcome (in fact it will through an expection). The reason is complex. In short, ipywidgets provides no blocking calls to wait for updates of a widget because the widget updates make use of the ipython event loop which does not get run during an execution of a cell.
Thus, to capture multiple screenshots at different times, one either needs to take one screenshot per cell, or use the following more convenient way:
End of explanation
<END_TASK>