[IPython-dev] D3 in IPython Notebook 2?

Anders Schneiderman ASchneiderman at asha.org
Thu Jun 12 08:41:38 EDT 2014


Hi Nicholas,

Your answer was really helpful, but after mucking about for a few days there are 2 places where I'm still stuck:

1) If I want to encapsulate the JavaScript, how do I do it? For example, in your IPython Notebook you create a Python class called CirclesWidget and some JavaScript that creates an IPython.DOMWidgetView subclass. Turning the CirclesWidget into a module and then calling it from an IPython Notebook via import is easy. How do I take the function part of the JavaScript require and take the equivalent action so that another user could use some new widget without having to dump a bunch of JavaScript into their notebook? I haven't worked with JavaScript in a long time, and I couldn't figure it out looking at the require.js documentation – and the example custom widgets in IPython Notebook 2.0  include their JavaScript in the same notebook that calls the widget.

2) you wrote:
Note that traitlets for containers (list, dict) are not instrumented in core (yet), so you'll have to do a bit of your own bookkeeping there.

Can you give me a hint as to what that might look like? I'm not looking for a full blown answer, just a sentence steering me in the right direction.

Thanks,
Anders
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140612/ad5ccef5/attachment.html>


More information about the IPython-dev mailing list