[IPython-User] Javascript interaction with python objects in notebook

Chris Currivan ccurrivan@gmail....
Sat Jan 7 11:13:05 CST 2012

I'm hoping to create something like an interactive plot with
checkboxes for which lines to display. I can create the html objects
from markdown or _repr_html_/display/publish_html. I can refer the
click events to javascript defined elsewhere in a markdown cell,
however that javascript can't return any information to the python
code. Is is possible to use the notebook's internal interface to allow
user javascript to send python calls to the kernel?

Is there an easy way to access matplotlib images in html/javascript in
order to display them some way besides in a column below whatever was
published last?

Are there any examples of _repr_javascript_? I've tried a few
variations of returning javascript code and none seem to execute. An
example that didn't work:

class Foo(object):
    def _repr_javascript_(self):
        print "Here"
        return """
function show_alert()
alert("Hello! I am an alert box!");
foo = Foo()

<__main__.Foo at 0x40df510>


More information about the IPython-User mailing list