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

David Powell DavidAnthonyPowell+python at gmail.com
Sun Nov 2 19:55:11 EST 2014


Thankyou Patrick,

I see that you have managed to get the trackball controls working
correctly in the notebook, so obviously it is possible. I already
found that HTML output instead of javascript is necessary, because the
"element" DOM object does not seem to be present after nbconverting to
html. When I get time to check carefully through your code, I'm sure
I'll get enough hints to solve my problem.

regards
David

On 31 October 2014 23:05, Patrick Fuller <patrickfuller at gmail.com> wrote:
> In case it helps, here are two projects that work the way you want with
> trackball: imolecule and igraph. The code of interest is here. 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
>>
>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>



More information about the IPython-dev mailing list