[IPython-dev] Conflict between IPython notebook javascript and three.js?

Patrick Fuller patrickfuller at gmail.com
Fri Oct 31 08:05:48 EDT 2014


In case it helps, here are two projects that work the way you want with
trackball: imolecule <http://patrick-fuller.com/imolecule/> and igraph
<http://patrick-fuller.com/igraph/>. The code of interest is here
<https://github.com/patrickfuller/igraph/blob/master/python/notebook.py#L70-L95>.
It’s been a while since I’ve looked at this, but I believe my trick was to
use _repr_html_ instead of _repr_javascript_ in order to make a new div.

Hope this helps,
Pat
​

On Fri, Oct 31, 2014 at 2:19 AM, David Powell <
DavidAnthonyPowell+python at gmail.com> wrote:

> I am trying to display 3D objects in IPython notebooks, and so far
> three.js looks like the most promising approach. In particular, it is
> important that the 3D plot is still visible after converting the
> notebook to html.
>
> So far I have succeeded in getting a basic example working, by
> adapting
> http://nbviewer.ipython.org/github/payne92/notebooks/blob/master/00%20Javascript%20In%20Notebooks.ipynb
>
> However, I run into problems when I include the trackball controls
> from three.js, and restrict the controls to input only on the cavas
> DOM element (so that clicking outside the canvas does not modify the
> perspective). The trackball controls do not work correctly, as can be
> seen by running the attached notebook example.
>
> When I export the notebook to html, I see that the wegbl output is
> present as I wanted. Furthermore, it seems that in the html, the
> trackball controls work perfectly. This suggests that the problem is
> some kind of conflict with the notebook's javascript. Any hints as to
> the possible cause of this problem would be greatly appreciated.
>
> In case it matters, I am using IPython 2.3
>
> regards
> David
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20141031/e236c858/attachment.html>


More information about the IPython-dev mailing list