#16270: Ipython notebook
------------------------+-------------------------------------------
Reporter: elixyre | Owner:
Type: task | Status: new
Priority: major | Milestone: sage-6.2
Component: notebook | Keywords: ipython, latex, display
Merged in: | Authors: Jean-Baptiste Priez
Reviewers: | Report Upstream: N/A
Work issues: | Branch:
Commit: | Dependencies:
Stopgaps: |
------------------------+-------------------------------------------
The ipython notebook is a very pleasant tool.
I would like to use sage notebook methods to produce image in the ipython
notebook?
In particular, I would like to know how the sage notebook do that.
At the end, I would like to use the ipython tools which try to find a
*_repr_foo_* method.
{{{
from IPython.display import Image
class myObject(SageObject):
def _repr_png_(self):
f = produce_a_file_with_the_sage_notebook_tools(self, ...)
return Image(f).data
}}}
I made some tests:
{{{
from IPython.display import Image
file = "/Users/elix/img.png"
def _repr_png_(self):
latex.eval(latex(self), locals(), filename=file)
return Image(filename=file, format='png').data
BinaryTree._repr_png_ = _repr_png_
BinaryTree([[],[[],[]]])
}}}
that produces
[[Image(http://kerios.fr/downloads/trac/imgbt.png)]]
but
{{{
e = (1 - sqrt(1 - 4*x)) / (2*x)
latex.eval(latex(e), locals(), filename=file)
}}}
will produce an error... so that is not the good way...
--
Ticket URL: <http://trac.sagemath.org/ticket/16270>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.