MCPcopy Create free account
hub / github.com/ipython/ipython / display

Function display

IPython/core/display.py:131–322  ·  view source on GitHub ↗

Display a Python object in all frontends. By default all representations will be computed and sent to the frontends. Frontends can decide which representation is used and how. In terminal IPython this will be similar to using :func:`print`, for use in richer frontends see Jupyter n

(*objs, include=None, exclude=None, metadata=None, transient=None, display_id=None, **kwargs)

Source from the content-addressed store, hash-verified

129
130
131def display(*objs, include=None, exclude=None, metadata=None, transient=None, display_id=None, **kwargs):
132 """Display a Python object in all frontends.
133
134 By default all representations will be computed and sent to the frontends.
135 Frontends can decide which representation is used and how.
136
137 In terminal IPython this will be similar to using :func:`print`, for use in richer
138 frontends see Jupyter notebook examples with rich display logic.
139
140 Parameters
141 ----------
142 objs : tuple of objects
143 The Python objects to display.
144 raw : bool, optional
145 Are the objects to be displayed already mimetype-keyed dicts of raw display data,
146 or Python objects that need to be formatted before display? [default: False]
147 include : list, tuple or set, optional
148 A list of format type strings (MIME types) to include in the
149 format data dict. If this is set *only* the format types included
150 in this list will be computed.
151 exclude : list, tuple or set, optional
152 A list of format type strings (MIME types) to exclude in the format
153 data dict. If this is set all format types will be computed,
154 except for those included in this argument.
155 metadata : dict, optional
156 A dictionary of metadata to associate with the output.
157 mime-type keys in this dictionary will be associated with the individual
158 representation formats, if they exist.
159 transient : dict, optional
160 A dictionary of transient data to associate with the output.
161 Data in this dict should not be persisted to files (e.g. notebooks).
162 display_id : str, bool optional
163 Set an id for the display.
164 This id can be used for updating this display area later via update_display.
165 If given as `True`, generate a new `display_id`
166 kwargs: additional keyword-args, optional
167 Additional keyword-arguments are passed through to the display publisher.
168
169 Returns
170 -------
171
172 handle: DisplayHandle
173 Returns a handle on updatable displays for use with :func:`update_display`,
174 if `display_id` is given. Returns :any:`None` if no `display_id` is given
175 (default).
176
177 Examples
178 --------
179
180 >>> class Json(object):
181 ... def __init__(self, json):
182 ... self.json = json
183 ... def _repr_pretty_(self, pp, cycle):
184 ... import json
185 ... pp.text(json.dumps(self.json, indent=2))
186 ... def __repr__(self):
187 ... return str(self.json)
188 ...

Callers 13

_ipython_display_Method · 0.90
display_pageFunction · 0.90
javascriptMethod · 0.90
latexMethod · 0.90
svgMethod · 0.90
htmlMethod · 0.90
markdownMethod · 0.90
_display_mimetypeFunction · 0.70
update_displayFunction · 0.70
displayMethod · 0.70
displayMethod · 0.70
updateMethod · 0.70

Calls 5

_new_idFunction · 0.85
publish_display_dataFunction · 0.85
_mergeFunction · 0.85
DisplayHandleClass · 0.85
popMethod · 0.80

Tested by 1

_ipython_display_Method · 0.72