[IPython-dev] embedding js9 into a notebook
Gijs Molenaar
gijsmolenaar at gmail.com
Thu Oct 1 08:45:43 EDT 2015
Hi all! I'm trying to embed JS9 into a notebook, but I'm not successful
yet. I hope this is the right place to ask a question about this. JS9 is
the javascript version of DS9, an astronomical image viewer:
http://js9.si.edu/
You can find my initial work here:
https://github.com/gijzelaerr/js9notebook
I could not really find documentation on how to create such a thing. My
idea was to create a python package which you can pip and load, just like
bokeh works. I see multiple ways you can inject javascript into the
browser from the python code, but I think using
IPython.core.displaypub.publish_display_data is probably best.
https://github.com/gijzelaerr/js9notebook/blob/master/js9notebook/__init__.py#L18
I was assuming reading the javascript file like this and then executing it
with publish_display_data would be the same as loading it with a script
tag, but I keep getting all kind of errors about objects not defined:
https://github.com/gijzelaerr/js9notebook/blob/master/example/js9notebook.ipynb
So basically I have two questions:
* Is this the right way to do such a thing? I find it a bit hard to find
out where the problems are, isn't it possible to serve the javascript
somewhere static?
* What am I doing wrong loading javascript this way?
Greetings,
--
Gijs Molenaar
http://pythonic.nl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20151001/3e595216/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot from 2015-10-01 14:24:47.png
Type: image/png
Size: 114223 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20151001/3e595216/attachment.png>
More information about the IPython-dev
mailing list