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

Class DisplayHandle

IPython/core/display.py:346–393  ·  view source on GitHub ↗

A handle on an updatable display Call `.update(obj)` to display a new object. Call `.display(obj`) to add a new instance of this display, and update existing instances. See Also -------- :func:`display`, :func:`update_display`

Source from the content-addressed store, hash-verified

344
345
346class DisplayHandle(object):
347 """A handle on an updatable display
348
349 Call `.update(obj)` to display a new object.
350
351 Call `.display(obj`) to add a new instance of this display,
352 and update existing instances.
353
354 See Also
355 --------
356
357 :func:`display`, :func:`update_display`
358
359 """
360
361 def __init__(self, display_id=None):
362 if display_id is None:
363 display_id = _new_id()
364 self.display_id = display_id
365
366 def __repr__(self):
367 return "<%s display_id=%s>" % (self.__class__.__name__, self.display_id)
368
369 def display(self, obj, **kwargs):
370 """Make a new display with my id, updating existing instances.
371
372 Parameters
373 ----------
374
375 obj:
376 object to display
377 **kwargs:
378 additional keyword arguments passed to display
379 """
380 display(obj, display_id=self.display_id, **kwargs)
381
382 def update(self, obj, **kwargs):
383 """Update existing displays with my id
384
385 Parameters
386 ----------
387
388 obj:
389 object to display
390 **kwargs:
391 additional keyword arguments passed to update_display
392 """
393 update_display(obj, display_id=self.display_id, **kwargs)
394
395
396def display_pretty(*objs, **kwargs):

Callers 1

displayFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected