[IPython-User] %%javascript and %%svg

Benjie Chen benjie@ginkgobioworks....
Thu Aug 16 10:06:16 CDT 2012


Fantastic! Now I can output js/svg UIs from my python code!

On Thu, Aug 16, 2012 at 10:27 AM, Thomas Kluyver <takowl@gmail.com> wrote:
> On 16 August 2012 14:58, Benjie Chen <benjie@ginkgobioworks.com> wrote:
>> Is there a way to evaluate them dynamically? I'd like to have a piece
>> of python code output %%javascript or %%svg. Is there a magic like
>> %eval that evaluates these outputs? Or is there another way for the
>> python code to inject javascript or svg code?
>
> Yes, the cell magics are just shorthands.
>
> For quick use:
>
> from IPython.core.display import Javascript, SVG
> Javascript(data=string_of_js_code)
>
> For more object-oriented code, you can give any object
> _repr_javascript_ or _repr_svg_ methods. And there are other
> possibilities like png and latex.
>
> Hope that helps,
> Thomas
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user


More information about the IPython-User mailing list