[IPython-User] Fwd: Importing javascript file

Ricardo Amézquita ramezquitao@gmail....
Sun Sep 16 19:21:26 CDT 2012


Solved. I found I should add the library in the Javascript call.

Javascript(js,lib="/static/three.min.js")

Thanks

Ricardo Amézquita Orozco

ramezquitao@cihologramas.com
ramezquitao@unal.edu.co
ramezquitao@gmail.com


---------- Forwarded message ----------
From: Ricardo Amézquita <ramezquitao@gmail.com>
Date: 2012/9/16
Subject: Importing javascript file
To: *IPython-User@scipy.org*


I'm trying to develop a 3D viewer in webGL to be used in the ipython
notebook.

Right now I have been able to use standard webGL from the notebook, and now
I'm triying to use the three.js library (http://mrdoob.github.com/three.js/),
but I haven't been able to make it visible for my scripts.

I did the following:

Copy the three.min.js file in the .config/ipython/n/profile_default/static/

When I open the browser in http://127.0.0.1:8888/static/three.min.js I can
see the file.

But when I try to use it in a script:

display(HTML("<script src='/static/three.min.js'></script>"))

js="""
            var container, stats;
            var camera, scene, renderer;

            init();
            animate();
......
......
"""
"""
display(Javascript(js))

I get an error message

Error in Javascript !
ReferenceError: THREE is not defined
See your browser Javascript console for more details.

But THREE is defined in the three.min.js file.

I have tried different ways to import the js file without success.

Can some one point me in the wright direction?

Regards

Ricardo




Ricardo Amézquita Orozco

ramezquitao@cihologramas.com
ramezquitao@unal.edu.co
ramezquitao@gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20120916/6a4af630/attachment.html 


More information about the IPython-User mailing list