##// END OF EJS Templates
Document that _repr_*_() can return metadata...
Zi Chong Kao -
Show More
@@ -25,7 +25,7 b' Rich display'
25 ============
25 ============
26
26
27 The notebook and the Qt console can display richer representations of objects.
27 The notebook and the Qt console can display richer representations of objects.
28 To use this, you can define any number of ``_repr_*_()`` methods. Note that
28 To use this, you can define any of a number of ``_repr_*_()`` methods. Note that
29 these are surrounded by single, not double underscores.
29 these are surrounded by single, not double underscores.
30
30
31 Both the notebook and the Qt console can display ``svg``, ``png`` and ``jpeg``
31 Both the notebook and the Qt console can display ``svg``, ``png`` and ``jpeg``
@@ -43,11 +43,11 b' For example::'
43 return "<h1>" + self.text + "</h1>"
43 return "<h1>" + self.text + "</h1>"
44
44
45 We often want to provide frontends with guidance on how to display the data. To
45 We often want to provide frontends with guidance on how to display the data. To
46 support this, ``_repr_*_()`` methods can also return a data, metadata tuple where
46 support this, ``_repr_*_()`` methods can also return a ``(data, metadata)``
47 metadata is a dictionary containing arbitrary key, value pairs for the frontend
47 tuple where ``metadata`` is a dictionary containing arbitrary key-value pairs for
48 to interpret. An example use case is ``_repr_jpeg()``, which can be set to
48 the frontend to interpret. An example use case is ``_repr_jpeg_()``, which can
49 return a jpeg image and a ``{'height': 400, 'width': 600}`` dictionary to inform
49 be set to return a jpeg image and a ``{'height': 400, 'width': 600}`` dictionary
50 the frontend how to size the image.
50 to inform the frontend how to size the image.
51
51
52 There are also two more powerful display methods:
52 There are also two more powerful display methods:
53
53
General Comments 0
You need to be logged in to leave comments. Login now