Show More
@@ -238,16 +238,22 b' def display(*objs, include=None, exclude=None, metadata=None, transient=None, di' | |||||
238 | want to use. Here is a list of the names of the special methods and the |
|
238 | want to use. Here is a list of the names of the special methods and the | |
239 | values they must return: |
|
239 | values they must return: | |
240 |
|
240 | |||
241 | - `_repr_html_`: return raw HTML as a string |
|
241 | - `_repr_html_`: return raw HTML as a string, or a tuple (see below). | |
242 | - `_repr_json_`: return a JSONable dict |
|
242 | - `_repr_json_`: return a JSONable dict, or a tuple (see below). | |
243 | - `_repr_jpeg_`: return raw JPEG data |
|
243 | - `_repr_jpeg_`: return raw JPEG data, or a tuple (see below). | |
244 | - `_repr_png_`: return raw PNG data |
|
244 | - `_repr_png_`: return raw PNG data, or a tuple (see below). | |
245 | - `_repr_svg_`: return raw SVG data as a string |
|
245 | - `_repr_svg_`: return raw SVG data as a string, or a tuple (see below). | |
246 |
- `_repr_latex_`: return LaTeX commands in a string surrounded by "$" |
|
246 | - `_repr_latex_`: return LaTeX commands in a string surrounded by "$", | |
|
247 | or a tuple (see below). | |||
247 | - `_repr_mimebundle_`: return a full mimebundle containing the mapping |
|
248 | - `_repr_mimebundle_`: return a full mimebundle containing the mapping | |
248 | from all mimetypes to data. |
|
249 | from all mimetypes to data. | |
249 | Use this for any mime-type not listed above. |
|
250 | Use this for any mime-type not listed above. | |
250 |
|
251 | |||
|
252 | The above functions may also return the object's metadata alonside the | |||
|
253 | data. If the metadata is available, the functions will return a tuple | |||
|
254 | containing the data and metadata, in that order. If there is no metadata | |||
|
255 | available, then the functions will return the data only. | |||
|
256 | ||||
251 | When you are directly writing your own classes, you can adapt them for |
|
257 | When you are directly writing your own classes, you can adapt them for | |
252 | display in IPython by following the above approach. But in practice, you |
|
258 | display in IPython by following the above approach. But in practice, you | |
253 | often need to work with existing classes that you can't easily modify. |
|
259 | often need to work with existing classes that you can't easily modify. |
General Comments 0
You need to be logged in to leave comments.
Login now