Permalink
Browse files

scratch dans un notebook

  • Loading branch information...
sdpython committed Apr 12, 2015
1 parent 64d3d87 commit d845c458d61e4ba05150218d12a412b569438aa5
Showing with 91,339 additions and 0 deletions.
  1. +281 −0 _doc/notebooks/scratch/scratch_dans_un_notebook.ipynb
  2. BIN _doc/notebooks/scratch/screenshot_scratch_nb.png
  3. +33 −0 _doc/sphinxdoc/source/blog/2015/2015-04-12_scratch_notebook.rst
  4. +2 −0 setup.py
  5. 0 src/code_beatrix/jsscripts/__init__.py
  6. BIN src/code_beatrix/jsscripts/snap/Snap! Connectivity Strategy.pdf
  7. 0 src/code_beatrix/jsscripts/snap/__init__.py
  8. +661 −0 src/code_beatrix/jsscripts/snap/agpl.txt
  9. +55 −0 src/code_beatrix/jsscripts/snap/alonzo.svg
  10. +10,965 −0 src/code_beatrix/jsscripts/snap/blocks.js
  11. +3,407 −0 src/code_beatrix/jsscripts/snap/byob.js
  12. BIN src/code_beatrix/jsscripts/snap/click.wav
  13. +642 −0 src/code_beatrix/jsscripts/snap/cloud.js
  14. +173 −0 src/code_beatrix/jsscripts/snap/contributing to BYOB4.txt
  15. BIN src/code_beatrix/jsscripts/snap/favicon.ico
  16. +6,453 −0 src/code_beatrix/jsscripts/snap/gui.js
  17. +2,482 −0 src/code_beatrix/jsscripts/snap/history.txt
  18. +1,192 −0 src/code_beatrix/jsscripts/snap/lang-bn.js
  19. +1,277 −0 src/code_beatrix/jsscripts/snap/lang-ca.js
  20. +1,136 −0 src/code_beatrix/jsscripts/snap/lang-cs.js
  21. +1,298 −0 src/code_beatrix/jsscripts/snap/lang-de.js
  22. +1,168 −0 src/code_beatrix/jsscripts/snap/lang-dk.js
  23. +1,226 −0 src/code_beatrix/jsscripts/snap/lang-el.js
  24. +1,077 −0 src/code_beatrix/jsscripts/snap/lang-eo.js
  25. +1,124 −0 src/code_beatrix/jsscripts/snap/lang-es.js
  26. +1,280 −0 src/code_beatrix/jsscripts/snap/lang-fi.js
  27. +1,166 −0 src/code_beatrix/jsscripts/snap/lang-fr.js
  28. +1,291 −0 src/code_beatrix/jsscripts/snap/lang-it.js
  29. +1,250 −0 src/code_beatrix/jsscripts/snap/lang-ja.js
  30. +1,250 −0 src/code_beatrix/jsscripts/snap/lang-ja_HIRA.js
  31. +1,273 −0 src/code_beatrix/jsscripts/snap/lang-kn.js
  32. +1,394 −0 src/code_beatrix/jsscripts/snap/lang-ko.js
  33. +1,282 −0 src/code_beatrix/jsscripts/snap/lang-ml.js
  34. +1,216 −0 src/code_beatrix/jsscripts/snap/lang-nl.js
  35. +1 −0 src/code_beatrix/jsscripts/snap/lang-no.js
  36. +1,225 −0 src/code_beatrix/jsscripts/snap/lang-pl.js
  37. +1,696 −0 src/code_beatrix/jsscripts/snap/lang-pt.js
  38. +1,389 −0 src/code_beatrix/jsscripts/snap/lang-pt_BR.js
  39. +1,125 −0 src/code_beatrix/jsscripts/snap/lang-ru.js
  40. +1,069 −0 src/code_beatrix/jsscripts/snap/lang-si.js
  41. +1,359 −0 src/code_beatrix/jsscripts/snap/lang-sv.js
  42. +1,283 −0 src/code_beatrix/jsscripts/snap/lang-ta.js
  43. +1,283 −0 src/code_beatrix/jsscripts/snap/lang-te.js
  44. +1,214 −0 src/code_beatrix/jsscripts/snap/lang-tw.js
  45. +1,214 −0 src/code_beatrix/jsscripts/snap/lang-zh.js
  46. +697 −0 src/code_beatrix/jsscripts/snap/lists.js
  47. +477 −0 src/code_beatrix/jsscripts/snap/locale.js
  48. +13 −0 src/code_beatrix/jsscripts/snap/manifest.mf
  49. +25 −0 src/code_beatrix/jsscripts/snap/minimal.html
  50. +49 −0 src/code_beatrix/jsscripts/snap/morphic.html
  51. +10,869 −0 src/code_beatrix/jsscripts/snap/morphic.js
  52. +1,031 −0 src/code_beatrix/jsscripts/snap/morphic.txt
  53. +33 −0 src/code_beatrix/jsscripts/snap/multiple.html
  54. +7,374 −0 src/code_beatrix/jsscripts/snap/objects.js
  55. +1,005 −0 src/code_beatrix/jsscripts/snap/paint.js
  56. +24 −0 src/code_beatrix/jsscripts/snap/readme.txt
  57. +347 −0 src/code_beatrix/jsscripts/snap/sha512.js
  58. +37 −0 src/code_beatrix/jsscripts/snap/snap.html
  59. BIN src/code_beatrix/jsscripts/snap/snap_logo_sm.png
  60. +1,900 −0 src/code_beatrix/jsscripts/snap/store.js
  61. +3,225 −0 src/code_beatrix/jsscripts/snap/threads.js
  62. +1 −0 src/code_beatrix/jsscripts/snap/tools.xml
  63. +143 −0 src/code_beatrix/jsscripts/snap/translating Snap.txt
  64. +3,292 −0 src/code_beatrix/jsscripts/snap/widgets.js
  65. +441 −0 src/code_beatrix/jsscripts/snap/xml.js
  66. +1,444 −0 src/code_beatrix/jsscripts/snap/ypr.js

Large diffs are not rendered by default.

Oops, something went wrong.
Binary file not shown.
@@ -0,0 +1,33 @@
.. blogpost::
:title: Scratch dans un notebook
:keywords: scratch, notebook, ipython, javascript
:date: 2015-04-12
:categories: scratch, notebook
Je me suis demandé s'il était possible d'inclure
facilement des projets Scratch dans le site web.
Etant donné qu'il est généré à l'aide de
`Sphinx <http://sphinx-doc.org/>`_, cela revenait à se demander
s'il existe une version Javascript de
`Scratch <https://scratch.mit.edu/>`_.
Celle-ci s'appelle `Snap! <http://snap.berkeley.edu/snapsource/snap.html>`_.
Je suis tombé ensuite sur cette page
`How-To: Control a PoppyCreature using the visual programming language Snap! (a variant of Scratch) <http://nbviewer.ipython.org/github/poppy-project/pypot/blob/master/samples/notebooks/Controlling%20a%20Poppy%20Creature%20using%20SNAP.ipynb>`_
qui donne quelques liens sur comment se dépatouiller avec Snap.
Un peu plus loin
l'astuce décrite dans l'article
`More about interactive graphs using Python, d3.js, R, shiny, IPython, vincent, d3py, python-nvd3 <http://www.xavierdupre.fr/blog/2013-11-30_nojs.html>`_
m'a permis de construire le notebook suivant :
:ref:`scratchdansunnotebookrst`.
Il me reste à convertir les fichiers d'extensions ``.sb2`` que
Scratch utilise pour sauver ses projets mais j'ai bon
espoir d'y arriver avec
`Snapin8r <https://github.com/Hardmath123/Snapin8r>`_.
A quoi ça sert... à pouvoir jouer avec les solutions
sans même avoir à installer quoi que ce soit et automatiser
le tout.
View
@@ -88,6 +88,8 @@
package_data = {project_var_name + ".scratch.example_echiquier": ["*.sb2"],
project_var_name + ".scratch.example_tri": ["*.sb2"],
project_var_name + ".scratch.example_pyramide": ["*.sb2"],
project_var_name + ".scratch.example_chute": ["*.sb2"],
project_var_name + ".jsscripts.snap": ["*.*"],
}
if os.path.exists(readme):
No changes.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="95px" height="123px" viewBox="0 0 95 123" enable-background="new 0 0 95 123" xml:space="preserve">
<g id="ID0.8323829737491906" transform="matrix(1, 0, 0, 1, 0, 3)">
<path id="R_Leg" fill="#FFC93E" stroke="#603813" stroke-width="3" d="M47.316,104.251c0-1.276,0.358-3.109,2.338-3.523
c2.857-0.599,6.126,2.293,7.014,3.146c-0.065,0.338,1.047,7.173,1.047,7.765c0,2.004-0.535,2.083-0.743,2.116
c-1.956,0.284-7.169-5.197-9.562-8.387C47.376,105.193,47.316,104.809,47.316,104.251L47.316,104.251L47.316,104.251z"/>
<path id="Center_Leg" fill="#FFC93E" stroke="#603813" stroke-width="4" d="M39.394,113.827c-1.418-1.538-1.621-5.707-1.621-7.482
c0-0.752,0.039-1.253,0.041-1.268l0.002-0.039c0,0-0.004-0.16-0.004-0.219c0-3.341,3.075-4.501,3.597-4.675
c1.781,0.021,4.858,0.864,5.593,2.136c0.075,0.128,0.144,0.289,0.144,0.495c0,0.181-0.054,0.4-0.208,0.666
c-0.071,0.121-1.335,3.109-2.405,5.4l-0.765,2.119c-0.572,1.851-1.473,3.703-2.452,3.703
C40.542,114.666,39.914,114.392,39.394,113.827L39.394,113.827L39.394,113.827z"/>
<path id="R_Arm" fill="#FFC93E" stroke="#603813" stroke-width="3" d="M79.505,89.611l-1.383-2.44
c-1.516-2.637-3.265-5.052-4.807-7.177c-1.983-2.738-3.71-5.571-4.281-7.572c-0.207-0.721-0.107-1.41,0.189-1.79
c0.028-0.102,0.327-0.265,0.539-0.309c2.541-0.55,13.06,5.491,15.685,8.719c3.845,4.727,5.382,11.358,4.524,14.699
c-0.352,1.364-1.139,2.332-2.278,2.793C84.782,97.71,82.867,95.586,79.505,89.611L79.505,89.611L79.505,89.611z"/>
<path id="Body" fill="#FFC93E" stroke="#603813" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" d="
M38.097,43.007c0,0-3.11-9.629-6.011-13.598c-1.72-2.79-4.2-6.267-7.477-6.049c-4.067,0.106-6.283,4.984-10.299,6.545
c-2.602,1.003-9.461,2.314-8.406,0c2.813-5.814,14.04-9.079,16.844-16.379c1.263-3.305-4.272-7.252-7.941-7.942
c-2.745-0.501-4.039,4.217-6.545,5.615c-1.151,0.643-4.339,1.305-3.753,0C6.629,6.836,9.052,1.172,13.845-0.495
c3.617-1.254,7.562,2.473,10.299,5.119c8.464,8.185,15.617,17.938,23.24,26.65l4.511,5.139c0,0,3.225,3.956,5.692,6.566
c0.044,0.045,2.378-0.317,3.989-1.657c1.314-1.096,1.141-2.323,1.559-4.902c0.384-2.371,0.802-6.659,2.072-6.681
c1.916-0.029,3.176,7.868,3.666,10.793l0.272,1.565c0.643,3.479,3.999,13.94,4.144,14.384c0.046,0.108,0.121,0.249,0.121,0.249
l0.027,0.056l0.038,0.047c5.185,6.429,9.038,14.223,9.038,21.524c0,15.464-13.555,26.349-31.697,26.349
c-3.365,0-6.657-0.473-9.783-1.398l-0.168-0.049c0,0-4.908-0.412-11.186,7.84c-1.26,1.657-1.147,3.201-2.922,2.726
c-0.592-0.158-1.026-0.593-1.382-1.383c-0.848-1.884-0.222-6.347,0.816-9.197l0.163-0.448l-0.375-0.297
c-0.092-0.073-10.274-7.493-11.303-18.125c-0.896-9.268,3.785-14.545,5.728-17.444l1.117-1.858
c1.409-3.428-1.243-8.195-3.583-12.401c-1.397-2.511-3.652-6.176-3.143-7.038c0.565-0.954,2.585,0.062,4.625,1.034
c1.654,0.791,3.245,1.908,4.35,1.171c1.149-0.765,0.396-2.686-0.649-5.346c-0.982-2.498-2.841-6.443-2.127-8.072
c0.197-0.447,0.542-0.762,1.055-0.961c1.897-0.734,4.609,2.461,6.805,4.961C31.532,41.469,34.57,44.927,38.097,43.007
L38.097,43.007L38.097,43.007z"/>
<g id="L_Eye">
<path id="White_1_" fill="#FFFFFF" d="M41.228,79.489c0,2.789,2.263,5.05,5.054,5.05c2.791,0,5.051-2.261,5.051-5.05
c0-2.791-2.261-5.056-5.051-5.056C43.49,74.436,41.228,76.698,41.228,79.489L41.228,79.489L41.228,79.489z"/>
<path id="Pupil_1_" fill="#603813" d="M46.961,75.796c0.981,0,1.87,0.398,2.513,1.043c0.645,0.643,1.042,1.532,1.042,2.513
c0,0.981-0.397,1.87-1.042,2.514c-0.644,0.644-1.532,1.042-2.513,1.042s-1.87-0.398-2.513-1.042
c-0.645-0.644-1.042-1.532-1.042-2.514c0-0.98,0.398-1.87,1.042-2.513C45.092,76.194,45.98,75.796,46.961,75.796L46.961,75.796z"
/>
</g>
<g id="R_Eye">
<path id="White" fill="#FFFFFF" d="M65.568,79.489c0,2.789,2.262,5.05,5.054,5.05c2.788,0,5.052-2.261,5.052-5.05
c0-2.791-2.262-5.056-5.052-5.056C67.83,74.436,65.568,76.698,65.568,79.489L65.568,79.489L65.568,79.489z"/>
<path id="Pupil" fill="#603813" d="M67.745,79.352c0,1.964,1.59,3.555,3.556,3.555c1.963,0,3.556-1.59,3.556-3.555
c0-1.962-1.593-3.556-3.556-3.556C69.335,75.796,67.745,77.389,67.745,79.352L67.745,79.352L67.745,79.352z"/>
</g>
<path id="L_Arm" fill="#FFC93E" stroke="#603813" stroke-width="3" d="M6.341,98.994c-1.036-0.661-1.633-1.753-1.729-3.161
c-0.234-3.445,2.492-9.682,7.134-13.626c3.17-2.694,14.617-6.707,17.014-5.703c0.198,0.083,0.463,0.297,0.472,0.404
c0.224,0.427,0.194,1.119-0.14,1.791c-0.927,1.864-3.142,4.335-5.594,6.66c-1.906,1.814-4.065,3.863-6.035,6.181l-1.807,2.141
C11.259,98.943,8.986,100.685,6.341,98.994L6.341,98.994L6.341,98.994z"/>
<path id="Mouth" fill="none" stroke="#603813" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M63.148,95.391
c0,0-4.599,0.004-7.819-2.756"/>
</g>
</svg>
Oops, something went wrong.

0 comments on commit d845c45

Please sign in to comment.