Show More
@@ -10,9 +10,27 b' from .widget import DOMWidget' | |||||
10 | import sys |
|
10 | import sys | |
11 | from IPython.utils.traitlets import Unicode, List |
|
11 | from IPython.utils.traitlets import Unicode, List | |
12 | from IPython.display import clear_output |
|
12 | from IPython.display import clear_output | |
|
13 | from IPython.testing.skipdoctest import skip_doctest | |||
13 |
|
14 | |||
|
15 | @skip_doctest | |||
14 | class Output(DOMWidget): |
|
16 | class Output(DOMWidget): | |
15 | """Displays multiple widgets in a group.""" |
|
17 | """Widget used as a context manager to display output. | |
|
18 | ||||
|
19 | This widget can capture and display stdout, stderr, and rich output. To use | |||
|
20 | it, create an instance of it and display it. Then use it as a context | |||
|
21 | manager. Any output produced while in it's context will be captured and | |||
|
22 | displayed in it instead of the standard output area. | |||
|
23 | ||||
|
24 | Example | |||
|
25 | from IPython.html import widgets | |||
|
26 | from IPython.display import display | |||
|
27 | out = widgets.Output() | |||
|
28 | display(out) | |||
|
29 | ||||
|
30 | print('prints to output area') | |||
|
31 | ||||
|
32 | with out: | |||
|
33 | print('prints to output widget')""" | |||
16 | _view_name = Unicode('OutputView', sync=True) |
|
34 | _view_name = Unicode('OutputView', sync=True) | |
17 |
|
35 | |||
18 | def clear_output(self, *pargs, **kwargs): |
|
36 | def clear_output(self, *pargs, **kwargs): |
General Comments 0
You need to be logged in to leave comments.
Login now