[IPython-dev] Embedding JointJS library

Nikolas Tezak ntezak at stanford.edu
Tue Feb 18 19:23:35 EST 2014


Hey, 
I figured it out.
To embed Javascript put it into the currently used ipython profile's 
"/static/custom" directory, i.e., for the default profile something like
"~/.ipython/profile_default/static/custom"

And then edit the custom js and css files:

custom.js
----
$([IPython.events]).on('app_initialized.NotebookApp', function () { 
require(['/static/custom/myjs.js']);
});
---

custom.css
----
@import url("mycss.css");
---

Sorry for the spam,

Nik

On Feb 18, 2014, at 3:46 PM, Nikolas Tezak wrote:

> Hi all,
> 
> I just installed the current IPython 2.0 dev version from github and I'm quite impressed! At this point I've converted half my lab to use IPython in their daily workflows. 
> I'm especially excited about the upcoming widget features.
> 
> Right now, I would like to try to embed a JointJS ( http://www.jointjs.com/ ) applet into an IPython notebook and have it talk back to the kernel. 
> The reason is that I want to create a graphical schematic capture tool for circuit diagrams.
> 
> I think I'll be able to figure out how to do this by emulating this:
> https://gist.github.com/minrk/6547109
> 
> However, I am already getting stuck on just importing the JointJS javascript library into a current notebook.
> 
> If I have a javascript file "joint.js" and a css file "joint.css" in the same directory as a given notebook, is there any easy way of importing these into the notebook?
> I have looked into the IPython.display.Javascript and HTML object but couldn't get it to work.
> 
> Thanks, 
> Nik
> 
> _______________________________________________
> 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