Hi Matthias,<br><br>Thank you for your helpful and pointed replies, will try out the new json plugin. <br>I see he gave a demo as part of Brian's NYC PyData talk which looks very promising.<br><br>Cheers,<br><br>Wen<br>
<br><div class="gmail_quote">On Sat, Nov 24, 2012 at 6:10 AM, Matthias BUSSONNIER <span dir="ltr"><<a href="mailto:bussonniermatthias@gmail.com" target="_blank">bussonniermatthias@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Le 24 nov. 2012 à 04:04, W Gong a écrit :<br>
Hi,<br>
<div class="im"><br>
> Hi,<br>
> I learned ipython notebook a few days ago and like it very much,<br>
> To me, IPython Notebook is a new generation of web browser because it brings exploration and interactivity to user.<br>
><br>
> One question is how to add widget support (e.g. embed canvas, drawing board, java applet).<br>
<br>
</div>Depending on what you exactly want to do you might have different way of doing it.<br>
<br>
The first thing you can do is use display protocol (see docs/example/notebook/display_protocol.ipynb) to define html/latex/json representation for object.<br>
<br>
other example<br>
<a href="http://nbviewer.ipython.org/urls/raw.github.com/ipython/ipython/master/docs/examples/notebooks/00_notebook_tour.ipynb" target="_blank">http://nbviewer.ipython.org/urls/raw.github.com/ipython/ipython/master/docs/examples/notebooks/00_notebook_tour.ipynb</a><br>

Near the end, you have a youtube video python object which representation is an embedded youtube player.<br>
<div class="im"><br>
> To illustrate my use-case, here is a notebook  that I created to teach python to 10 yr old kids. To make it more interesting or engaging, I combine rich text, image,  video with code. In this example, I used HTML() to embed a javascript clock at the beginning. But how would one do the same in python?<br>

<br>
</div>The other thing we are working on are json plugin<br>
<a href="https://github.com/ipython/ipython/pull/2518" target="_blank">https://github.com/ipython/ipython/pull/2518</a><br>
<br>
have a look at <a href="http://vimeo.com/channels/pydata/53051817" target="_blank">http://vimeo.com/channels/pydata/53051817</a><br>
for demo.<br>
<div class="im"><br>
><br>
> I have another use-case to embed java applet:<br>
> Nobel Physicist - Carl Wieman at U of Colorado - Bolder has a wonderful science education initiative called PhET which is to bring virtual lab to science students.<br>
> If teachers and students can perform virtual experiment, at the same time, do calculations in math/physics via sympy and write a lab report, all within the IPython notebook, it would be a huge boost to our education.<br>

<br>
</div>You should be able to do the same and use a custom _repr_html_ to display this form python.<br>
<br>
I think the introduction notebook in /docs/example/notebooks/ are a good start to see what could be done.<br>
<br>
<br>
also, you can share static version of your notebook through <a href="http://nbviewer.ipython.org" target="_blank">nbviewer.ipython.org</a>.<br>
<br>
here is what it looks for yours.<br>
<a href="http://nbviewer.ipython.org/url/dl.dropbox.com/u/54552252/what-is-time.ipynb" target="_blank">http://nbviewer.ipython.org/url/dl.dropbox.com/u/54552252/what-is-time.ipynb</a><br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Matthias<br>
_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div><br></div><div>Thanks,</div><div><br></div>- Wen<br><br><br><br><br>