[IPython-User] Fwd: Importing javascript file

Matthias BUSSONNIER bussonniermatthias@gmail....
Mon Sep 17 02:03:24 CDT 2012


Glad you solved it. 

I don't now if it might be of help, but 

https://github.com/ipython/ipython/pull/2258

Is a PR that is also linked to 3D in browser. 
-- 
Matthias

Le 17 sept. 2012 à 02:21, Ricardo Amézquita a écrit :

> 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
> 
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20120917/1eabe07e/attachment.html 


More information about the IPython-User mailing list