##// END OF EJS Templates
Added clear kwarg to display()
Douglas Blank -
Show More
@@ -120,6 +120,9 b' def display(*objs, include=None, exclude=None, metadata=None, transient=None, di'
120 Set an id for the display.
120 Set an id for the display.
121 This id can be used for updating this display area later via update_display.
121 This id can be used for updating this display area later via update_display.
122 If given as `True`, generate a new `display_id`
122 If given as `True`, generate a new `display_id`
123 clear : bool, optional
124 Should the output area be cleared before displaying anything? If True,
125 this will wait for additional output before clearing. [default: False]
123 kwargs: additional keyword-args, optional
126 kwargs: additional keyword-args, optional
124 Additional keyword-arguments are passed through to the display publisher.
127 Additional keyword-arguments are passed through to the display publisher.
125
128
@@ -239,7 +242,8 b' def display(*objs, include=None, exclude=None, metadata=None, transient=None, di'
239 print(*objs)
242 print(*objs)
240 return
243 return
241
244
242 raw = kwargs.pop('raw', False)
245 raw = kwargs.pop("raw", False)
246 clear = kwargs.pop("clear", False)
243 if transient is None:
247 if transient is None:
244 transient = {}
248 transient = {}
245 if metadata is None:
249 if metadata is None:
@@ -263,6 +267,9 b' def display(*objs, include=None, exclude=None, metadata=None, transient=None, di'
263 if not raw:
267 if not raw:
264 format = InteractiveShell.instance().display_formatter.format
268 format = InteractiveShell.instance().display_formatter.format
265
269
270 if clear:
271 clear_output(wait=True)
272
266 for obj in objs:
273 for obj in objs:
267 if raw:
274 if raw:
268 publish_display_data(data=obj, metadata=metadata, **kwargs)
275 publish_display_data(data=obj, metadata=metadata, **kwargs)
General Comments 0
You need to be logged in to leave comments. Login now