|
23 | 23 | ],
|
24 | 24 | "source": [
|
25 | 25 | "import ipywidgets as widgets\n",
|
26 |
| - "from IPython.display import clear_output\n", |
27 | 26 | "output1 = widgets.Output()\n",
|
28 | 27 | "output1"
|
29 | 28 | ]
|
|
79 | 78 | }
|
80 | 79 | ],
|
81 | 80 | "source": [
|
82 |
| - "import ipywidgets as widgets\n", |
83 | 81 | "output2 = widgets.Output()\n",
|
84 | 82 | "output2"
|
85 | 83 | ]
|
|
100 | 98 | "source": [
|
101 | 99 | "print(\"hi2\")\n",
|
102 | 100 | "with output2:\n",
|
103 |
| - " print(\"in output2\")\n", |
104 |
| - " clear_output(wait=True)" |
| 101 | + " print(\"in output2\")\n" |
105 | 102 | ]
|
106 | 103 | },
|
107 | 104 | {
|
|
126 | 123 | }
|
127 | 124 | ],
|
128 | 125 | "source": [
|
129 |
| - "import ipywidgets as widgets\n", |
130 | 126 | "output3 = widgets.Output()\n",
|
131 | 127 | "output3"
|
132 | 128 | ]
|
|
148 | 144 | "print(\"hi3\")\n",
|
149 | 145 | "with output3:\n",
|
150 | 146 | " print(\"hello\")\n",
|
151 |
| - " clear_output(wait=True)\n", |
152 | 147 | " print(\"world\")"
|
153 | 148 | ]
|
154 | 149 | },
|
|
174 | 169 | }
|
175 | 170 | ],
|
176 | 171 | "source": [
|
177 |
| - "import ipywidgets as widgets\n", |
178 | 172 | "output4 = widgets.Output()\n",
|
179 | 173 | "output4"
|
180 | 174 | ]
|
|
195 | 189 | "source": [
|
196 | 190 | "print(\"hi4\")\n",
|
197 | 191 | "with output4:\n",
|
198 |
| - " print(\"hello world\")\n", |
199 |
| - " clear_output()" |
| 192 | + " print(\"hello world\")\n" |
200 | 193 | ]
|
201 | 194 | },
|
202 | 195 | {
|
|
221 | 214 | }
|
222 | 215 | ],
|
223 | 216 | "source": [
|
224 |
| - "import ipywidgets as widgets\n", |
225 | 217 | "output5 = widgets.Output()\n",
|
226 | 218 | "output5"
|
227 | 219 | ]
|
|
234 | 226 | "source": [
|
235 | 227 | "print(\"hi5\")\n",
|
236 | 228 | "with output5:\n",
|
237 |
| - " display(\"hello world\") # this is not a stream but plain text\n", |
238 |
| - "clear_output()" |
| 229 | + " display(\"hello world\") # this is not a stream but plain text\n" |
239 | 230 | ]
|
240 | 231 | },
|
241 | 232 | {
|
|
260 | 251 | }
|
261 | 252 | ],
|
262 | 253 | "source": [
|
263 |
| - "import ipywidgets as widgets\n", |
264 | 254 | "output_outer = widgets.Output()\n",
|
265 | 255 | "output_inner = widgets.Output()\n",
|
266 | 256 | "output_inner"
|
|
296 | 286 | "execution_count": 14,
|
297 | 287 | "metadata": {},
|
298 | 288 | "outputs": [],
|
299 |
| - "source": [ |
300 |
| - "with output_inner:\n", |
301 |
| - " print('in inner')\n", |
302 |
| - " with output_outer:\n", |
303 |
| - " print('in outer')\n", |
304 |
| - " print('also in inner')" |
305 |
| - ] |
| 289 | + "source": [] |
306 | 290 | },
|
307 | 291 | {
|
308 | 292 | "cell_type": "code",
|
|
0 commit comments