[IPython-dev] live input widgets

Jason Grout jason-sage@creativetrax....
Sat Apr 13 09:23:36 CDT 2013


I've been experimenting with having live javascript input widgets in 
codemirror (e.g., the sage cell, samuel's port of the notebook, 
William's salvus project, the IPython notebook, etc.)

Here's a very simple proof-of-concept:

http://jsfiddle.net/gh/gist/jquery/2.x/5378313/ (repository at 
https://gist.github.com/jasongrout/5378313 )

In the lower right pane, highlight an integer and press "Insert Widget". 
  Then you can change the integer by clicking on the buttons.

Once we can have javascript widgets on the input, whole new worlds are open:

* live images in the input code, automatically uploaded to the server, 
drag and drop from your browser, or even just an image editor so you can 
draw your image
* live mathjax-based equation editors
* matrix/table data editors
* a d3-based live graph editor (i.e., vertices and edges), right in the 
input

and a huge number of other possibilities.

Anyways, I thought people here would be interested.

You'll notice that the text content has weird unicode characters in it 
delimiting the boundaries of the widget.  The live widgets can put just 
single values in the text, but they can also embed json-encoded 
messages.  When the cell is interpreted for evaluation, the unicode 
widget delimiters can be stripped out, the message decoded and relevant 
python code generated, and then the widget message replaced with the 
generated python code.

Thanks,

Jason


More information about the IPython-dev mailing list