Skip to content

Commit 6ed1eb7

Browse files
author
Martin Durant
committed
Directly alter notebook cell output
1 parent 2c18ef2 commit 6ed1eb7

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

streamz/core.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ def __str__(self):
336336
def _ipython_display_(self, **kwargs):
337337
try:
338338
from ipywidgets import Output
339-
import IPython
339+
from IPython.core.interactiveshell import InteractiveShell
340340
except ImportError:
341341
if hasattr(self, '_repr_html_'):
342342
return self._repr_html_()
@@ -350,8 +350,11 @@ def update_cell(val):
350350
if output is None:
351351
return
352352
with output:
353-
IPython.display.clear_output(wait=True)
354-
IPython.display.display(val)
353+
content, *_ = InteractiveShell.instance(
354+
).display_formatter.format(val)
355+
output.outputs = ({'output_type': 'display_data',
356+
'data': content,
357+
'metadata': {}},)
355358

356359
s = self.map(update_cell)
357360
_html_update_streams.add(s)

0 commit comments

Comments
 (0)