--
You received this message because you are subscribed to the Google Groups "VPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vpython-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "VPython-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vpython-users/G4cdbaDO_lg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vpython-user...@googlegroups.com.
IPython.toolbar.add_buttons_group([
{
'label' : 'restart',
'icon' : 'icon-rocket', // select your icon from http://fortawesome.github.io/Font-Awesome/icons
'callback': function () {
IPython.notebook.kernel.execute('%reset -f')
IPython.notebook.execute_cells_above()
}
}
// add more button here if needed.
]);
});
The callback function for this button will clear all the variables in the IPython notebook and will then run all of the cells above the currently selected cell.
One way to add a custom button to a notebook is to create a custom ipython profile and add the custom button to the profile. Then you launch the IPython Notebook using this profile. For instance, I can create a custom profile called "vpython", add a custom button to the profile, then launch the IPython Notebook using this profile. Using the Windows Command prompt I can type
ipython profile create vpython
this creates a directory with a bunch of files on my machine at C:\Users\John\.ipython\profile_vpython . Edit the custom.js file adding the above code for the custom button. The custom.js file is located in the directory \.ipython\profile_vpython\static\custom . Then launch the IPython Notebook using the custom profile.
ipython notebook --profile=vpython
Now the IPython Notebook will contain a custom button that will clear all the variables and run all the cells above the currently selected cell.
Also there is a nice list of custom button icons that you can choose from for your custom buttons.
http://fortawesome.github.io/Font-Awesome/icons/
I chose the rocket icon from this list of icons.
John