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

David Powell DavidAnthonyPowell+python at gmail.com
Sun Nov 2 20:02:06 EST 2014


> This may or may not be an issue on top of this, but I've had problems
> with TrackballControls and OrbitControls (which I like better) accepting
> key events in the global page.  See
> https://github.com/mrdoob/three.js/pull/5236.

I avoided using OrbitControls for the same reason, but I didn't have
any problems with TrackballControls.


>>
>> 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.
>
> Do you see any errors in the javascript console?

No, I managed to get rid of all errors, and the problem still
persists. But I think Patrick's working example should give me enough
guidance to fix my problem.


> By the way, you may be interested in the pythreejs library, which is a
> wrapping of three.js as IPython widgets:
>
> https://github.com/jasongrout/pythreejs/tree/ipython
>
> (the ongoing IPython notebook work is in the ipython branch)
>
> See the examples folder for a few simple (and possibly out-of-date)
> examples.  It's still a work in progress, but it does work quite nicely
> already.  For example, see this example:
>
> http://nbviewer.ipython.org/github/jasongrout/pythreejs/blob/ipython/examples/Surface.ipynb
>

Great, this looks like it will be the preferred solution to my problem
in the long term. I tried running the examples, but I ran into the
following javascript exception, and didn't get any output:

Uncaught TypeError: Cannot read property 'obj' of undefined
pythreejs.js?_=1414974265086:329

> One disadvantage of using widgets, which may be a show-stopper for you
> right now, is that you can't see the 3d plot in nbviewer and with
> nbconvert.  Jon's recent work on widget persistence should fix that,
> hopefully soon.  We're reviewing his pull request now.

Yes I'm aware of this problem, and I'm glad to hear that a fix is on
the way. Is this expected to be incorporated into ipython v3.0?

thanks,
David



More information about the IPython-dev mailing list