{"cells": [{"cell_type": "markdown", "metadata": {}, "source": ["# Snap - partir d'un projet existant\n", "\n", "Snap ou Scratch dans un notebook. On s'assure d'abord que les fichiers javascript de *Snap* sont accessibles depuis le serveur IPython :"]}, {"cell_type": "code", "execution_count": 1, "metadata": {"scrolled": false}, "outputs": [{"data": {"text/plain": ["[('>+',\n", " ,\n", " 'c:\\\\Python36_x64\\\\lib\\\\site-packages\\\\notebook-5.0.0-py3.6.egg\\\\notebook\\\\static\\\\snap'),\n", " ('>+',\n", " ,\n", " 'c:\\\\Python36_x64\\\\lib\\\\site-packages\\\\notebook-5.0.0-py3.6.egg\\\\notebook\\\\static\\\\snap'),\n", " ('>+',\n", " ,\n", " 'c:\\\\Python36_x64\\\\lib\\\\site-packages\\\\notebook-5.0.0-py3.6.egg\\\\notebook\\\\static\\\\snap'),\n", " ('>+',\n", " ,\n", " 'c:\\\\Python36_x64\\\\lib\\\\site-packages\\\\notebook-5.0.0-py3.6.egg\\\\notebook\\\\static\\\\snap'),\n", " ('>+',\n", " ,\n", " 'c:\\\\Python36_x64\\\\lib\\\\site-packages\\\\notebook-5.0.0-py3.6.egg\\\\notebook\\\\static\\\\snap'),\n", " ('>-',\n", " None,\n", " )]"]}, "execution_count": 2, "metadata": {}, "output_type": "execute_result"}], "source": ["from code_beatrix.jsscripts import copy_jstool2notebook\n", "%load_ext code_beatrix\n", "copy_jstool2notebook(\"snap\")"]}, {"cell_type": "markdown", "metadata": {}, "source": ["Si le r\u00e9sultat est une liste vide, cela signifie que cela a d\u00e9j\u00e0 \u00e9t\u00e9 fait."]}, {"cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [{"name": "stdout", "output_type": "stream", "text": ["usage: snap [-h] [-f FILE] [-d DIV] [-W WIDTH] [-H HEIGHT]\n", "\n", "insert a snap window inside a notebook\n", "\n", "optional arguments:\n", " -h, --help show this help message and exit\n", " -f FILE, --file FILE scratch or snap file to display\n", " -d DIV, --div DIV id for the HTML div\n", " -W WIDTH, --width WIDTH\n", " window width\n", " -H HEIGHT, --height HEIGHT\n", " window height\n", "usage: snap [-h] [-f FILE] [-d DIV] [-W WIDTH] [-H HEIGHT]\n", "\n"]}], "source": ["%snap --help"]}, {"cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [{"data": {"text/html": ["\n", "
\n", " Snap showing up soon...\n", " \n", "
\n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", " "], "text/plain": [""]}, "execution_count": 4, "metadata": {}, "output_type": "execute_result"}], "source": ["# pas encore parfait, il faut mieux utiliser l'autre notebook.\n", "from code_beatrix.jsscripts.nbsnap import RenderSnap\n", "RenderSnap()"]}, {"cell_type": "code", "execution_count": 4, "metadata": {"scrolled": false}, "outputs": [{"data": {"text/html": ["\n", "
\n", " Snap showing up soon...\n", " \n", "
\n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", " "], "text/plain": [""]}, "execution_count": 5, "metadata": {}, "output_type": "execute_result"}], "source": ["%snap"]}, {"cell_type": "code", "execution_count": 5, "metadata": {"collapsed": true}, "outputs": [], "source": []}], "metadata": {"kernelspec": {"display_name": "Python 3", "language": "python", "name": "python3"}, "language_info": {"codemirror_mode": {"name": "ipython", "version": 3}, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.1"}}, "nbformat": 4, "nbformat_minor": 2}