Snap ou Scratch dans un notebook. On s'assure d'abord que les fichiers javascript de Snap sont accessibles depuis le serveur IPython :
from code_beatrix.jsscripts import copy_jstool2notebook
%load_ext code_beatrix
copy_jstool2notebook("snap")
[('>+', <pyquickhelper.filehelper.file_tree_node.FileTreeNode at 0x2981ff1f518>, 'c:\\Python36_x64\\lib\\site-packages\\notebook-5.0.0-py3.6.egg\\notebook\\static\\snap'), ('>+', <pyquickhelper.filehelper.file_tree_node.FileTreeNode at 0x2981ff51320>, 'c:\\Python36_x64\\lib\\site-packages\\notebook-5.0.0-py3.6.egg\\notebook\\static\\snap'), ('>+', <pyquickhelper.filehelper.file_tree_node.FileTreeNode at 0x2981ff35da0>, 'c:\\Python36_x64\\lib\\site-packages\\notebook-5.0.0-py3.6.egg\\notebook\\static\\snap'), ('>+', <pyquickhelper.filehelper.file_tree_node.FileTreeNode at 0x2981ffaca58>, 'c:\\Python36_x64\\lib\\site-packages\\notebook-5.0.0-py3.6.egg\\notebook\\static\\snap'), ('>+', <pyquickhelper.filehelper.file_tree_node.FileTreeNode at 0x2981ffacf60>, 'c:\\Python36_x64\\lib\\site-packages\\notebook-5.0.0-py3.6.egg\\notebook\\static\\snap'), ('>-', None, <pyquickhelper.filehelper.file_tree_node.FileTreeNode at 0x2982003dd68>)]
Si le résultat est une liste vide, cela signifie que cela a déjà été fait.
%snap --help
usage: snap [-h] [-f FILE] [-d DIV] [-W WIDTH] [-H HEIGHT] insert a snap window inside a notebook optional arguments: -h, --help show this help message and exit -f FILE, --file FILE scratch or snap file to display -d DIV, --div DIV id for the HTML div -W WIDTH, --width WIDTH window width -H HEIGHT, --height HEIGHT window height usage: snap [-h] [-f FILE] [-d DIV] [-W WIDTH] [-H HEIGHT]
# pas encore parfait, il faut mieux utiliser l'autre notebook.
from code_beatrix.jsscripts.nbsnap import RenderSnap
RenderSnap()
%snap