Show More
@@ -110,17 +110,7 b'' | |||||
110 | ], |
|
110 | ], | |
111 | "language": "python", |
|
111 | "language": "python", | |
112 | "metadata": {}, |
|
112 | "metadata": {}, | |
113 | "outputs": [ |
|
113 | "outputs": [], | |
114 | { |
|
|||
115 | "output_type": "stream", |
|
|||
116 | "stream": "stdout", |
|
|||
117 | "text": [ |
|
|||
118 | "['visible', '_css', '_children_attr', '_children_lists_attr', 'default_view_name', 'value', 'step', 'max', 'min', 'disabled', 'orientation', 'description']\n", |
|
|||
119 | "[]\n", |
|
|||
120 | "[]\n" |
|
|||
121 | ] |
|
|||
122 | } |
|
|||
123 | ], |
|
|||
124 | "prompt_number": 3 |
|
114 | "prompt_number": 3 | |
125 | }, |
|
115 | }, | |
126 | { |
|
116 | { | |
@@ -145,7 +135,7 b'' | |||||
145 | "cell_type": "code", |
|
135 | "cell_type": "code", | |
146 | "collapsed": false, |
|
136 | "collapsed": false, | |
147 | "input": [ |
|
137 | "input": [ | |
148 | "mywidget.value" |
|
138 | "mywidget.value\n" | |
149 | ], |
|
139 | ], | |
150 | "language": "python", |
|
140 | "language": "python", | |
151 | "metadata": {}, |
|
141 | "metadata": {}, | |
@@ -155,7 +145,7 b'' | |||||
155 | "output_type": "pyout", |
|
145 | "output_type": "pyout", | |
156 | "prompt_number": 13, |
|
146 | "prompt_number": 13, | |
157 | "text": [ |
|
147 | "text": [ | |
158 |
" |
|
148 | "42.7" | |
159 | ] |
|
149 | ] | |
160 | } |
|
150 | } | |
161 | ], |
|
151 | ], | |
@@ -182,12 +172,10 b'' | |||||
182 | { |
|
172 | { | |
183 | "metadata": {}, |
|
173 | "metadata": {}, | |
184 | "output_type": "pyout", |
|
174 | "output_type": "pyout", | |
185 |
"prompt_number": 1 |
|
175 | "prompt_number": 14, | |
186 | "text": [ |
|
176 | "text": [ | |
187 | "['visible',\n", |
|
177 | "['visible',\n", | |
188 | " '_css',\n", |
|
178 | " '_css',\n", | |
189 | " '_children_attr',\n", |
|
|||
190 | " '_children_lists_attr',\n", |
|
|||
191 | " 'default_view_name',\n", |
|
179 | " 'default_view_name',\n", | |
192 | " 'value',\n", |
|
180 | " 'value',\n", | |
193 | " 'step',\n", |
|
181 | " 'step',\n", | |
@@ -199,7 +187,7 b'' | |||||
199 | ] |
|
187 | ] | |
200 | } |
|
188 | } | |
201 | ], |
|
189 | ], | |
202 |
"prompt_number": 1 |
|
190 | "prompt_number": 14 | |
203 | }, |
|
191 | }, | |
204 | { |
|
192 | { | |
205 | "cell_type": "markdown", |
|
193 | "cell_type": "markdown", | |
@@ -217,7 +205,7 b'' | |||||
217 | "language": "python", |
|
205 | "language": "python", | |
218 | "metadata": {}, |
|
206 | "metadata": {}, | |
219 | "outputs": [], |
|
207 | "outputs": [], | |
220 |
"prompt_number": 1 |
|
208 | "prompt_number": 15 | |
221 | }, |
|
209 | }, | |
222 | { |
|
210 | { | |
223 | "cell_type": "markdown", |
|
211 | "cell_type": "markdown", | |
@@ -238,13 +226,13 b'' | |||||
238 | { |
|
226 | { | |
239 | "metadata": {}, |
|
227 | "metadata": {}, | |
240 | "output_type": "pyout", |
|
228 | "output_type": "pyout", | |
241 |
"prompt_number": |
|
229 | "prompt_number": 16, | |
242 | "text": [ |
|
230 | "text": [ | |
243 | "25.0" |
|
231 | "25.0" | |
244 | ] |
|
232 | ] | |
245 | } |
|
233 | } | |
246 | ], |
|
234 | ], | |
247 |
"prompt_number": |
|
235 | "prompt_number": 16 | |
248 | }, |
|
236 | }, | |
249 | { |
|
237 | { | |
250 | "cell_type": "markdown", |
|
238 | "cell_type": "markdown", | |
@@ -262,18 +250,8 b'' | |||||
262 | ], |
|
250 | ], | |
263 | "language": "python", |
|
251 | "language": "python", | |
264 | "metadata": {}, |
|
252 | "metadata": {}, | |
265 | "outputs": [ |
|
253 | "outputs": [], | |
266 | { |
|
254 | "prompt_number": 17 | |
267 | "output_type": "stream", |
|
|||
268 | "stream": "stdout", |
|
|||
269 | "text": [ |
|
|||
270 | "['visible', '_css', '_children_attr', '_children_lists_attr', 'default_view_name', 'value', 'values', 'disabled', 'description']\n", |
|
|||
271 | "[]\n", |
|
|||
272 | "[]\n" |
|
|||
273 | ] |
|
|||
274 | } |
|
|||
275 | ], |
|
|||
276 | "prompt_number": 14 |
|
|||
277 | }, |
|
255 | }, | |
278 | { |
|
256 | { | |
279 | "cell_type": "code", |
|
257 | "cell_type": "code", | |
@@ -287,13 +265,13 b'' | |||||
287 | { |
|
265 | { | |
288 | "metadata": {}, |
|
266 | "metadata": {}, | |
289 | "output_type": "pyout", |
|
267 | "output_type": "pyout", | |
290 |
"prompt_number": 1 |
|
268 | "prompt_number": 18, | |
291 | "text": [ |
|
269 | "text": [ | |
292 |
"u' |
|
270 | "u'Nothing Selected'" | |
293 | ] |
|
271 | ] | |
294 | } |
|
272 | } | |
295 | ], |
|
273 | ], | |
296 |
"prompt_number": 1 |
|
274 | "prompt_number": 18 | |
297 | }, |
|
275 | }, | |
298 | { |
|
276 | { | |
299 | "cell_type": "heading", |
|
277 | "cell_type": "heading", | |
@@ -322,13 +300,13 b'' | |||||
322 | { |
|
300 | { | |
323 | "metadata": {}, |
|
301 | "metadata": {}, | |
324 | "output_type": "pyout", |
|
302 | "output_type": "pyout", | |
325 |
"prompt_number": 1 |
|
303 | "prompt_number": 19, | |
326 | "text": [ |
|
304 | "text": [ | |
327 | "u'FloatSliderView'" |
|
305 | "u'FloatSliderView'" | |
328 | ] |
|
306 | ] | |
329 | } |
|
307 | } | |
330 | ], |
|
308 | ], | |
331 |
"prompt_number": 1 |
|
309 | "prompt_number": 19 | |
332 | }, |
|
310 | }, | |
333 | { |
|
311 | { | |
334 | "cell_type": "markdown", |
|
312 | "cell_type": "markdown", | |
@@ -347,7 +325,7 b'' | |||||
347 | "language": "python", |
|
325 | "language": "python", | |
348 | "metadata": {}, |
|
326 | "metadata": {}, | |
349 | "outputs": [], |
|
327 | "outputs": [], | |
350 |
"prompt_number": |
|
328 | "prompt_number": 20 | |
351 | }, |
|
329 | }, | |
352 | { |
|
330 | { | |
353 | "cell_type": "markdown", |
|
331 | "cell_type": "markdown", |
This diff has been collapsed as it changes many lines, (555 lines changed) Show them Hide them | |||||
@@ -25,7 +25,7 b'' | |||||
25 | "language": "python", |
|
25 | "language": "python", | |
26 | "metadata": {}, |
|
26 | "metadata": {}, | |
27 | "outputs": [], |
|
27 | "outputs": [], | |
28 |
"prompt_number": |
|
28 | "prompt_number": 2 | |
29 | }, |
|
29 | }, | |
30 | { |
|
30 | { | |
31 | "cell_type": "heading", |
|
31 | "cell_type": "heading", | |
@@ -82,7 +82,7 b'' | |||||
82 | ] |
|
82 | ] | |
83 | } |
|
83 | } | |
84 | ], |
|
84 | ], | |
85 |
"prompt_number": |
|
85 | "prompt_number": 3 | |
86 | }, |
|
86 | }, | |
87 | { |
|
87 | { | |
88 | "cell_type": "markdown", |
|
88 | "cell_type": "markdown", | |
@@ -108,7 +108,7 b'' | |||||
108 | "def on_value_change(name, value):\n", |
|
108 | "def on_value_change(name, value):\n", | |
109 | " print(value)\n", |
|
109 | " print(value)\n", | |
110 | "\n", |
|
110 | "\n", | |
111 |
" |
|
111 | "intrange.on_trait_change(on_value_change, 'value')" | |
112 | ], |
|
112 | ], | |
113 | "language": "python", |
|
113 | "language": "python", | |
114 | "metadata": {}, |
|
114 | "metadata": {}, | |
@@ -117,13 +117,298 b'' | |||||
117 | "output_type": "stream", |
|
117 | "output_type": "stream", | |
118 | "stream": "stdout", |
|
118 | "stream": "stdout", | |
119 | "text": [ |
|
119 | "text": [ | |
120 | "['visible', '_css', '_children_attr', '_children_lists_attr', 'default_view_name', 'value', 'step', 'max', 'min', 'disabled', 'orientation', 'description']\n", |
|
120 | "1\n" | |
121 |
|
|
121 | ] | |
122 | "[]\n" |
|
122 | }, | |
|
123 | { | |||
|
124 | "output_type": "stream", | |||
|
125 | "stream": "stdout", | |||
|
126 | "text": [ | |||
|
127 | "2\n" | |||
|
128 | ] | |||
|
129 | }, | |||
|
130 | { | |||
|
131 | "output_type": "stream", | |||
|
132 | "stream": "stdout", | |||
|
133 | "text": [ | |||
|
134 | "3\n" | |||
|
135 | ] | |||
|
136 | }, | |||
|
137 | { | |||
|
138 | "output_type": "stream", | |||
|
139 | "stream": "stdout", | |||
|
140 | "text": [ | |||
|
141 | "4\n" | |||
|
142 | ] | |||
|
143 | }, | |||
|
144 | { | |||
|
145 | "output_type": "stream", | |||
|
146 | "stream": "stdout", | |||
|
147 | "text": [ | |||
|
148 | "5\n" | |||
|
149 | ] | |||
|
150 | }, | |||
|
151 | { | |||
|
152 | "output_type": "stream", | |||
|
153 | "stream": "stdout", | |||
|
154 | "text": [ | |||
|
155 | "6\n" | |||
|
156 | ] | |||
|
157 | }, | |||
|
158 | { | |||
|
159 | "output_type": "stream", | |||
|
160 | "stream": "stdout", | |||
|
161 | "text": [ | |||
|
162 | "7\n" | |||
|
163 | ] | |||
|
164 | }, | |||
|
165 | { | |||
|
166 | "output_type": "stream", | |||
|
167 | "stream": "stdout", | |||
|
168 | "text": [ | |||
|
169 | "8\n" | |||
|
170 | ] | |||
|
171 | }, | |||
|
172 | { | |||
|
173 | "output_type": "stream", | |||
|
174 | "stream": "stdout", | |||
|
175 | "text": [ | |||
|
176 | "9\n" | |||
|
177 | ] | |||
|
178 | }, | |||
|
179 | { | |||
|
180 | "output_type": "stream", | |||
|
181 | "stream": "stdout", | |||
|
182 | "text": [ | |||
|
183 | "10\n" | |||
|
184 | ] | |||
|
185 | }, | |||
|
186 | { | |||
|
187 | "output_type": "stream", | |||
|
188 | "stream": "stdout", | |||
|
189 | "text": [ | |||
|
190 | "11\n" | |||
|
191 | ] | |||
|
192 | }, | |||
|
193 | { | |||
|
194 | "output_type": "stream", | |||
|
195 | "stream": "stdout", | |||
|
196 | "text": [ | |||
|
197 | "12\n" | |||
|
198 | ] | |||
|
199 | }, | |||
|
200 | { | |||
|
201 | "output_type": "stream", | |||
|
202 | "stream": "stdout", | |||
|
203 | "text": [ | |||
|
204 | "13\n" | |||
|
205 | ] | |||
|
206 | }, | |||
|
207 | { | |||
|
208 | "output_type": "stream", | |||
|
209 | "stream": "stdout", | |||
|
210 | "text": [ | |||
|
211 | "14\n" | |||
|
212 | ] | |||
|
213 | }, | |||
|
214 | { | |||
|
215 | "output_type": "stream", | |||
|
216 | "stream": "stdout", | |||
|
217 | "text": [ | |||
|
218 | "15\n" | |||
|
219 | ] | |||
|
220 | }, | |||
|
221 | { | |||
|
222 | "output_type": "stream", | |||
|
223 | "stream": "stdout", | |||
|
224 | "text": [ | |||
|
225 | "16\n" | |||
|
226 | ] | |||
|
227 | }, | |||
|
228 | { | |||
|
229 | "output_type": "stream", | |||
|
230 | "stream": "stdout", | |||
|
231 | "text": [ | |||
|
232 | "17\n" | |||
|
233 | ] | |||
|
234 | }, | |||
|
235 | { | |||
|
236 | "output_type": "stream", | |||
|
237 | "stream": "stdout", | |||
|
238 | "text": [ | |||
|
239 | "18\n" | |||
|
240 | ] | |||
|
241 | }, | |||
|
242 | { | |||
|
243 | "output_type": "stream", | |||
|
244 | "stream": "stdout", | |||
|
245 | "text": [ | |||
|
246 | "20\n" | |||
|
247 | ] | |||
|
248 | }, | |||
|
249 | { | |||
|
250 | "output_type": "stream", | |||
|
251 | "stream": "stdout", | |||
|
252 | "text": [ | |||
|
253 | "19\n" | |||
|
254 | ] | |||
|
255 | }, | |||
|
256 | { | |||
|
257 | "output_type": "stream", | |||
|
258 | "stream": "stdout", | |||
|
259 | "text": [ | |||
|
260 | "18\n" | |||
|
261 | ] | |||
|
262 | }, | |||
|
263 | { | |||
|
264 | "output_type": "stream", | |||
|
265 | "stream": "stdout", | |||
|
266 | "text": [ | |||
|
267 | "17\n" | |||
|
268 | ] | |||
|
269 | }, | |||
|
270 | { | |||
|
271 | "output_type": "stream", | |||
|
272 | "stream": "stdout", | |||
|
273 | "text": [ | |||
|
274 | "16\n" | |||
|
275 | ] | |||
|
276 | }, | |||
|
277 | { | |||
|
278 | "output_type": "stream", | |||
|
279 | "stream": "stdout", | |||
|
280 | "text": [ | |||
|
281 | "12\n" | |||
|
282 | ] | |||
|
283 | }, | |||
|
284 | { | |||
|
285 | "output_type": "stream", | |||
|
286 | "stream": "stdout", | |||
|
287 | "text": [ | |||
|
288 | "10\n" | |||
|
289 | ] | |||
|
290 | }, | |||
|
291 | { | |||
|
292 | "output_type": "stream", | |||
|
293 | "stream": "stdout", | |||
|
294 | "text": [ | |||
|
295 | "8\n" | |||
|
296 | ] | |||
|
297 | }, | |||
|
298 | { | |||
|
299 | "output_type": "stream", | |||
|
300 | "stream": "stdout", | |||
|
301 | "text": [ | |||
|
302 | "6\n" | |||
|
303 | ] | |||
|
304 | }, | |||
|
305 | { | |||
|
306 | "output_type": "stream", | |||
|
307 | "stream": "stdout", | |||
|
308 | "text": [ | |||
|
309 | "4\n" | |||
|
310 | ] | |||
|
311 | }, | |||
|
312 | { | |||
|
313 | "output_type": "stream", | |||
|
314 | "stream": "stdout", | |||
|
315 | "text": [ | |||
|
316 | "3\n" | |||
|
317 | ] | |||
|
318 | }, | |||
|
319 | { | |||
|
320 | "output_type": "stream", | |||
|
321 | "stream": "stdout", | |||
|
322 | "text": [ | |||
|
323 | "2\n" | |||
|
324 | ] | |||
|
325 | }, | |||
|
326 | { | |||
|
327 | "output_type": "stream", | |||
|
328 | "stream": "stdout", | |||
|
329 | "text": [ | |||
|
330 | "1\n" | |||
|
331 | ] | |||
|
332 | }, | |||
|
333 | { | |||
|
334 | "output_type": "stream", | |||
|
335 | "stream": "stdout", | |||
|
336 | "text": [ | |||
|
337 | "4\n" | |||
|
338 | ] | |||
|
339 | }, | |||
|
340 | { | |||
|
341 | "output_type": "stream", | |||
|
342 | "stream": "stdout", | |||
|
343 | "text": [ | |||
|
344 | "10\n" | |||
|
345 | ] | |||
|
346 | }, | |||
|
347 | { | |||
|
348 | "output_type": "stream", | |||
|
349 | "stream": "stdout", | |||
|
350 | "text": [ | |||
|
351 | "18\n" | |||
|
352 | ] | |||
|
353 | }, | |||
|
354 | { | |||
|
355 | "output_type": "stream", | |||
|
356 | "stream": "stdout", | |||
|
357 | "text": [ | |||
|
358 | "39\n" | |||
|
359 | ] | |||
|
360 | }, | |||
|
361 | { | |||
|
362 | "output_type": "stream", | |||
|
363 | "stream": "stdout", | |||
|
364 | "text": [ | |||
|
365 | "60\n" | |||
|
366 | ] | |||
|
367 | }, | |||
|
368 | { | |||
|
369 | "output_type": "stream", | |||
|
370 | "stream": "stdout", | |||
|
371 | "text": [ | |||
|
372 | "68\n" | |||
|
373 | ] | |||
|
374 | }, | |||
|
375 | { | |||
|
376 | "output_type": "stream", | |||
|
377 | "stream": "stdout", | |||
|
378 | "text": [ | |||
|
379 | "75\n" | |||
|
380 | ] | |||
|
381 | }, | |||
|
382 | { | |||
|
383 | "output_type": "stream", | |||
|
384 | "stream": "stdout", | |||
|
385 | "text": [ | |||
|
386 | "79\n" | |||
|
387 | ] | |||
|
388 | }, | |||
|
389 | { | |||
|
390 | "output_type": "stream", | |||
|
391 | "stream": "stdout", | |||
|
392 | "text": [ | |||
|
393 | "82\n" | |||
|
394 | ] | |||
|
395 | }, | |||
|
396 | { | |||
|
397 | "output_type": "stream", | |||
|
398 | "stream": "stdout", | |||
|
399 | "text": [ | |||
|
400 | "85\n" | |||
|
401 | ] | |||
|
402 | }, | |||
|
403 | { | |||
|
404 | "output_type": "stream", | |||
|
405 | "stream": "stdout", | |||
|
406 | "text": [ | |||
|
407 | "86\n" | |||
123 | ] |
|
408 | ] | |
124 | } |
|
409 | } | |
125 | ], |
|
410 | ], | |
126 |
"prompt_number": |
|
411 | "prompt_number": 5 | |
127 | }, |
|
412 | }, | |
128 | { |
|
413 | { | |
129 | "cell_type": "heading", |
|
414 | "cell_type": "heading", | |
@@ -175,7 +460,7 b'' | |||||
175 | ] |
|
460 | ] | |
176 | } |
|
461 | } | |
177 | ], |
|
462 | ], | |
178 |
"prompt_number": |
|
463 | "prompt_number": 6 | |
179 | }, |
|
464 | }, | |
180 | { |
|
465 | { | |
181 | "cell_type": "markdown", |
|
466 | "cell_type": "markdown", | |
@@ -200,269 +485,255 b'' | |||||
200 | "text": [ |
|
485 | "text": [ | |
201 | "hi\n" |
|
486 | "hi\n" | |
202 | ] |
|
487 | ] | |
203 | } |
|
488 | }, | |
204 | ], |
|
|||
205 | "prompt_number": 5 |
|
|||
206 | }, |
|
|||
207 | { |
|
|||
208 | "cell_type": "code", |
|
|||
209 | "collapsed": false, |
|
|||
210 | "input": [ |
|
|||
211 | "button = widgets.ButtonWidget(description=\"Click Me!\")\n", |
|
|||
212 | "display(button)\n", |
|
|||
213 | "\n", |
|
|||
214 | "def on_button_clicked(sender):\n", |
|
|||
215 | " print(\"Button clicked.\")\n", |
|
|||
216 | " intrange.value +=1\n", |
|
|||
217 | "\n", |
|
|||
218 | "button.on_click(on_button_clicked)" |
|
|||
219 | ], |
|
|||
220 | "language": "python", |
|
|||
221 | "metadata": {}, |
|
|||
222 | "outputs": [ |
|
|||
223 | { |
|
489 | { | |
224 | "output_type": "stream", |
|
490 | "output_type": "stream", | |
225 | "stream": "stdout", |
|
491 | "stream": "stdout", | |
226 | "text": [ |
|
492 | "text": [ | |
227 | "['visible', '_css', '_children_attr', '_children_lists_attr', 'default_view_name', 'description', 'disabled']\n", |
|
493 | "85\n" | |
228 | "[]\n", |
|
|||
229 | "[]\n" |
|
|||
230 | ] |
|
494 | ] | |
231 | }, |
|
495 | }, | |
232 | { |
|
496 | { | |
233 | "output_type": "stream", |
|
497 | "output_type": "stream", | |
234 | "stream": "stdout", |
|
498 | "stream": "stdout", | |
235 | "text": [ |
|
499 | "text": [ | |
236 | "Button clicked.\n" |
|
500 | "84\n" | |
237 | ] |
|
501 | ] | |
238 | }, |
|
502 | }, | |
239 | { |
|
503 | { | |
240 | "output_type": "stream", |
|
504 | "output_type": "stream", | |
241 | "stream": "stdout", |
|
505 | "stream": "stdout", | |
242 | "text": [ |
|
506 | "text": [ | |
243 | "Button clicked.\n" |
|
507 | "81\n" | |
244 | ] |
|
508 | ] | |
245 | }, |
|
509 | }, | |
246 | { |
|
510 | { | |
247 | "output_type": "stream", |
|
511 | "output_type": "stream", | |
248 | "stream": "stdout", |
|
512 | "stream": "stdout", | |
249 | "text": [ |
|
513 | "text": [ | |
250 | "Button clicked.\n" |
|
514 | "79\n" | |
251 | ] |
|
515 | ] | |
252 | }, |
|
516 | }, | |
253 | { |
|
517 | { | |
254 | "output_type": "stream", |
|
518 | "output_type": "stream", | |
255 | "stream": "stdout", |
|
519 | "stream": "stdout", | |
256 | "text": [ |
|
520 | "text": [ | |
257 | "Button clicked.\n" |
|
521 | "73\n" | |
258 | ] |
|
522 | ] | |
259 | } |
|
523 | }, | |
260 | ], |
|
|||
261 | "prompt_number": 12 |
|
|||
262 | }, |
|
|||
263 | { |
|
|||
264 | "cell_type": "markdown", |
|
|||
265 | "metadata": {}, |
|
|||
266 | "source": [ |
|
|||
267 | "Event handlers can also be used to create widgets. In the example below, clicking a button spawns another button with a description equal to how many times the parent button had been clicked at the time." |
|
|||
268 | ] |
|
|||
269 | }, |
|
|||
270 | { |
|
|||
271 | "cell_type": "code", |
|
|||
272 | "collapsed": false, |
|
|||
273 | "input": [], |
|
|||
274 | "language": "python", |
|
|||
275 | "metadata": {}, |
|
|||
276 | "outputs": [ |
|
|||
277 | { |
|
524 | { | |
278 | "metadata": {}, |
|
525 | "output_type": "stream", | |
279 |
" |
|
526 | "stream": "stdout", | |
280 | "prompt_number": 11, |
|
|||
281 | "text": [ |
|
527 | "text": [ | |
282 | "{'content': {'data': \"{'parent_header': {}, 'msg_type': u'comm_msg', 'msg_id': u'3DBB06AD83C942DD85DC6477B08F1FBF', 'content': {u'data': {u'method': u'custom', u'custom_content': {u'event': u'click'}}, u'comm_id': u'eea5f11ae7aa473993dd0c81d6016648'}, 'header': {u'username': u'username', u'msg_id': u'3DBB06AD83C942DD85DC6477B08F1FBF', u'msg_type': u'comm_msg', u'session': u'0F6D6BE728DA47A38CFC4BDEACF34FC4'}, 'buffers': [], 'metadata': {}}\\ncustom message {'parent_header': {}, 'msg_type': u'comm_msg', 'msg_id': u'3DBB06AD83C942DD85DC6477B08F1FBF', 'content': {u'data': {u'method': u'custom', u'custom_content': {u'event': u'click'}}, u'comm_id': u'eea5f11ae7aa473993dd0c81d6016648'}, 'header': {u'username': u'username', u'msg_id': u'3DBB06AD83C942DD85DC6477B08F1FBF', u'msg_type': u'comm_msg', u'session': u'0F6D6BE728DA47A38CFC4BDEACF34FC4'}, 'buffers': [], 'metadata': {}}\\nhandling click\\n{u'event': u'click'}\\nButton clicked.\\n2\\n\",\n", |
|
528 | "70\n" | |
283 | " 'name': 'stdout'},\n", |
|
|||
284 | " 'header': {'msg_id': 'd9dc144a-d86c-42c1-8bab-f8a6bc525723',\n", |
|
|||
285 | " 'msg_type': 'stream',\n", |
|
|||
286 | " 'session': '9b9408d8-7420-4e0c-976d-cdda9f8d2564',\n", |
|
|||
287 | " 'username': 'kernel'},\n", |
|
|||
288 | " 'metadata': {},\n", |
|
|||
289 | " 'msg_id': 'd9dc144a-d86c-42c1-8bab-f8a6bc525723',\n", |
|
|||
290 | " 'msg_type': 'stream',\n", |
|
|||
291 | " 'parent_header': {'msg_id': '3DBB06AD83C942DD85DC6477B08F1FBF',\n", |
|
|||
292 | " 'msg_type': 'comm_msg',\n", |
|
|||
293 | " 'session': '0F6D6BE728DA47A38CFC4BDEACF34FC4',\n", |
|
|||
294 | " 'username': 'username'}}" |
|
|||
295 | ] |
|
529 | ] | |
296 | } |
|
530 | }, | |
297 | ], |
|
|||
298 | "prompt_number": 11 |
|
|||
299 | }, |
|
|||
300 | { |
|
|||
301 | "cell_type": "code", |
|
|||
302 | "collapsed": false, |
|
|||
303 | "input": [ |
|
|||
304 | "def show_button(sender=None):\n", |
|
|||
305 | " button = widgets.ButtonWidget()\n", |
|
|||
306 | " button.clicks = 0\n", |
|
|||
307 | " if sender is None:\n", |
|
|||
308 | " button.description = \"0\"\n", |
|
|||
309 | " else:\n", |
|
|||
310 | " sender.clicks += 1\n", |
|
|||
311 | " button.description = \"%d\" % sender.clicks\n", |
|
|||
312 | " display(button)\n", |
|
|||
313 | " button.on_click(show_button)\n", |
|
|||
314 | "show_button()\n", |
|
|||
315 | " " |
|
|||
316 | ], |
|
|||
317 | "language": "python", |
|
|||
318 | "metadata": {}, |
|
|||
319 | "outputs": [ |
|
|||
320 | { |
|
531 | { | |
321 | "output_type": "stream", |
|
532 | "output_type": "stream", | |
322 | "stream": "stdout", |
|
533 | "stream": "stdout", | |
323 | "text": [ |
|
534 | "text": [ | |
324 | "['visible', '_css', '_children_attr', '_children_lists_attr', 'default_view_name', 'description', 'disabled']\n", |
|
535 | "67\n" | |
325 | "[]\n", |
|
|||
326 | "[]\n" |
|
|||
327 | ] |
|
536 | ] | |
328 | }, |
|
537 | }, | |
329 | { |
|
538 | { | |
330 | "output_type": "stream", |
|
539 | "output_type": "stream", | |
331 | "stream": "stdout", |
|
540 | "stream": "stdout", | |
332 | "text": [ |
|
541 | "text": [ | |
333 | "['visible', '_css', '_children_attr', '_children_lists_attr', 'default_view_name', 'description', 'disabled']\n", |
|
542 | "59\n" | |
334 | "[]\n", |
|
|||
335 | "[]\n" |
|
|||
336 | ] |
|
543 | ] | |
337 | }, |
|
544 | }, | |
338 | { |
|
545 | { | |
339 | "output_type": "stream", |
|
546 | "output_type": "stream", | |
340 | "stream": "stdout", |
|
547 | "stream": "stdout", | |
341 | "text": [ |
|
548 | "text": [ | |
342 | "['visible', '_css', '_children_attr', '_children_lists_attr', 'default_view_name', 'description', 'disabled']\n", |
|
549 | "56\n" | |
343 | "[]\n", |
|
|||
344 | "[]\n" |
|
|||
345 | ] |
|
550 | ] | |
346 | }, |
|
551 | }, | |
347 | { |
|
552 | { | |
348 | "output_type": "stream", |
|
553 | "output_type": "stream", | |
349 | "stream": "stdout", |
|
554 | "stream": "stdout", | |
350 | "text": [ |
|
555 | "text": [ | |
351 | "['visible', '_css', '_children_attr', '_children_lists_attr', 'default_view_name', 'description', 'disabled']\n", |
|
556 | "53\n" | |
352 | "[]\n", |
|
|||
353 | "[]\n" |
|
|||
354 | ] |
|
557 | ] | |
355 | }, |
|
558 | }, | |
356 | { |
|
559 | { | |
357 | "output_type": "stream", |
|
560 | "output_type": "stream", | |
358 | "stream": "stdout", |
|
561 | "stream": "stdout", | |
359 | "text": [ |
|
562 | "text": [ | |
360 | "['visible', '_css', '_children_attr', '_children_lists_attr', 'default_view_name', 'description', 'disabled']\n", |
|
563 | "51\n" | |
361 | "[]\n", |
|
|||
362 | "[]\n" |
|
|||
363 | ] |
|
564 | ] | |
364 | }, |
|
565 | }, | |
365 | { |
|
566 | { | |
366 | "output_type": "stream", |
|
567 | "output_type": "stream", | |
367 | "stream": "stdout", |
|
568 | "stream": "stdout", | |
368 | "text": [ |
|
569 | "text": [ | |
369 | "['visible', '_css', '_children_attr', '_children_lists_attr', 'default_view_name', 'description', 'disabled']\n", |
|
570 | "49\n" | |
370 | "[]\n", |
|
|||
371 | "[]\n" |
|
|||
372 | ] |
|
571 | ] | |
373 | }, |
|
572 | }, | |
374 | { |
|
573 | { | |
375 | "output_type": "stream", |
|
574 | "output_type": "stream", | |
376 | "stream": "stdout", |
|
575 | "stream": "stdout", | |
377 | "text": [ |
|
576 | "text": [ | |
378 | "['visible', '_css', '_children_attr', '_children_lists_attr', 'default_view_name', 'description', 'disabled']\n", |
|
577 | "47\n" | |
379 | "[]\n", |
|
|||
380 | "[]\n" |
|
|||
381 | ] |
|
578 | ] | |
382 | }, |
|
579 | }, | |
383 | { |
|
580 | { | |
384 | "output_type": "stream", |
|
581 | "output_type": "stream", | |
385 | "stream": "stdout", |
|
582 | "stream": "stdout", | |
386 | "text": [ |
|
583 | "text": [ | |
387 | "['visible', '_css', '_children_attr', '_children_lists_attr', 'default_view_name', 'description', 'disabled']\n", |
|
584 | "45\n" | |
388 | "[]\n", |
|
|||
389 | "[]\n" |
|
|||
390 | ] |
|
585 | ] | |
391 | }, |
|
586 | }, | |
392 | { |
|
587 | { | |
393 | "output_type": "stream", |
|
588 | "output_type": "stream", | |
394 | "stream": "stdout", |
|
589 | "stream": "stdout", | |
395 | "text": [ |
|
590 | "text": [ | |
396 | "['visible', '_css', '_children_attr', '_children_lists_attr', 'default_view_name', 'description', 'disabled']\n", |
|
591 | "44\n" | |
397 | "[]\n", |
|
|||
398 | "[]\n" |
|
|||
399 | ] |
|
592 | ] | |
400 | }, |
|
593 | }, | |
401 | { |
|
594 | { | |
402 | "output_type": "stream", |
|
595 | "output_type": "stream", | |
403 | "stream": "stdout", |
|
596 | "stream": "stdout", | |
404 | "text": [ |
|
597 | "text": [ | |
405 | "['visible', '_css', '_children_attr', '_children_lists_attr', 'default_view_name', 'description', 'disabled']\n", |
|
598 | "42\n" | |
406 |
|
|
599 | ] | |
407 | "[]\n" |
|
600 | } | |
|
601 | ], | |||
|
602 | "prompt_number": 7 | |||
|
603 | }, | |||
|
604 | { | |||
|
605 | "cell_type": "code", | |||
|
606 | "collapsed": false, | |||
|
607 | "input": [ | |||
|
608 | "button = widgets.ButtonWidget(description=\"Click Me!\")\n", | |||
|
609 | "display(button)\n", | |||
|
610 | "\n", | |||
|
611 | "def on_button_clicked(sender):\n", | |||
|
612 | " print(\"Button clicked.\")\n", | |||
|
613 | " intrange.value +=1\n", | |||
|
614 | "\n", | |||
|
615 | "button.on_click(on_button_clicked)" | |||
|
616 | ], | |||
|
617 | "language": "python", | |||
|
618 | "metadata": {}, | |||
|
619 | "outputs": [ | |||
|
620 | { | |||
|
621 | "output_type": "stream", | |||
|
622 | "stream": "stdout", | |||
|
623 | "text": [ | |||
|
624 | "Button clicked.\n", | |||
|
625 | "43\n" | |||
408 | ] |
|
626 | ] | |
409 | }, |
|
627 | }, | |
410 | { |
|
628 | { | |
411 | "output_type": "stream", |
|
629 | "output_type": "stream", | |
412 | "stream": "stdout", |
|
630 | "stream": "stdout", | |
413 | "text": [ |
|
631 | "text": [ | |
414 | "['visible', '_css', '_children_attr', '_children_lists_attr', 'default_view_name', 'description', 'disabled']\n", |
|
632 | "Button clicked.\n", | |
415 |
" |
|
633 | "44\n" | |
416 | "[]\n" |
|
|||
417 | ] |
|
634 | ] | |
418 | }, |
|
635 | }, | |
419 | { |
|
636 | { | |
420 | "output_type": "stream", |
|
637 | "output_type": "stream", | |
421 | "stream": "stdout", |
|
638 | "stream": "stdout", | |
422 | "text": [ |
|
639 | "text": [ | |
423 | "['visible', '_css', '_children_attr', '_children_lists_attr', 'default_view_name', 'description', 'disabled']\n", |
|
640 | "Button clicked.\n", | |
424 |
" |
|
641 | "45\n" | |
425 | "[]\n" |
|
|||
426 | ] |
|
642 | ] | |
427 | }, |
|
643 | }, | |
428 | { |
|
644 | { | |
429 | "output_type": "stream", |
|
645 | "output_type": "stream", | |
430 | "stream": "stdout", |
|
646 | "stream": "stdout", | |
431 | "text": [ |
|
647 | "text": [ | |
432 | "['visible', '_css', '_children_attr', '_children_lists_attr', 'default_view_name', 'description', 'disabled']\n", |
|
648 | "Button clicked.\n", | |
433 |
" |
|
649 | "46\n" | |
434 | "[]\n" |
|
|||
435 | ] |
|
650 | ] | |
436 | }, |
|
651 | }, | |
437 | { |
|
652 | { | |
438 | "output_type": "stream", |
|
653 | "output_type": "stream", | |
439 | "stream": "stdout", |
|
654 | "stream": "stdout", | |
440 | "text": [ |
|
655 | "text": [ | |
441 | "['visible', '_css', '_children_attr', '_children_lists_attr', 'default_view_name', 'description', 'disabled']\n", |
|
656 | "Button clicked.\n", | |
442 |
" |
|
657 | "47\n" | |
443 | "[]\n" |
|
|||
444 | ] |
|
658 | ] | |
445 | }, |
|
659 | }, | |
446 | { |
|
660 | { | |
447 | "output_type": "stream", |
|
661 | "output_type": "stream", | |
448 | "stream": "stdout", |
|
662 | "stream": "stdout", | |
449 | "text": [ |
|
663 | "text": [ | |
450 | "['visible', '_css', '_children_attr', '_children_lists_attr', 'default_view_name', 'description', 'disabled']\n", |
|
664 | "Button clicked.\n", | |
451 |
" |
|
665 | "48\n" | |
452 | "[]\n" |
|
|||
453 | ] |
|
666 | ] | |
454 | }, |
|
667 | }, | |
455 | { |
|
668 | { | |
456 | "output_type": "stream", |
|
669 | "output_type": "stream", | |
457 | "stream": "stdout", |
|
670 | "stream": "stdout", | |
458 | "text": [ |
|
671 | "text": [ | |
459 | "['visible', '_css', '_children_attr', '_children_lists_attr', 'default_view_name', 'description', 'disabled']\n", |
|
672 | "Button clicked.\n", | |
460 |
" |
|
673 | "49\n" | |
461 | "[]\n" |
|
|||
462 | ] |
|
674 | ] | |
463 | } |
|
675 | } | |
464 | ], |
|
676 | ], | |
465 |
"prompt_number": |
|
677 | "prompt_number": 8 | |
|
678 | }, | |||
|
679 | { | |||
|
680 | "cell_type": "markdown", | |||
|
681 | "metadata": {}, | |||
|
682 | "source": [ | |||
|
683 | "Event handlers can also be used to create widgets. In the example below, clicking a button spawns another button with a description equal to how many times the parent button had been clicked at the time." | |||
|
684 | ] | |||
|
685 | }, | |||
|
686 | { | |||
|
687 | "cell_type": "code", | |||
|
688 | "collapsed": false, | |||
|
689 | "input": [], | |||
|
690 | "language": "python", | |||
|
691 | "metadata": {}, | |||
|
692 | "outputs": [ | |||
|
693 | { | |||
|
694 | "metadata": {}, | |||
|
695 | "output_type": "pyout", | |||
|
696 | "prompt_number": 11, | |||
|
697 | "text": [ | |||
|
698 | "{'content': {'data': \"{'parent_header': {}, 'msg_type': u'comm_msg', 'msg_id': u'3DBB06AD83C942DD85DC6477B08F1FBF', 'content': {u'data': {u'method': u'custom', u'custom_content': {u'event': u'click'}}, u'comm_id': u'eea5f11ae7aa473993dd0c81d6016648'}, 'header': {u'username': u'username', u'msg_id': u'3DBB06AD83C942DD85DC6477B08F1FBF', u'msg_type': u'comm_msg', u'session': u'0F6D6BE728DA47A38CFC4BDEACF34FC4'}, 'buffers': [], 'metadata': {}}\\ncustom message {'parent_header': {}, 'msg_type': u'comm_msg', 'msg_id': u'3DBB06AD83C942DD85DC6477B08F1FBF', 'content': {u'data': {u'method': u'custom', u'custom_content': {u'event': u'click'}}, u'comm_id': u'eea5f11ae7aa473993dd0c81d6016648'}, 'header': {u'username': u'username', u'msg_id': u'3DBB06AD83C942DD85DC6477B08F1FBF', u'msg_type': u'comm_msg', u'session': u'0F6D6BE728DA47A38CFC4BDEACF34FC4'}, 'buffers': [], 'metadata': {}}\\nhandling click\\n{u'event': u'click'}\\nButton clicked.\\n2\\n\",\n", | |||
|
699 | " 'name': 'stdout'},\n", | |||
|
700 | " 'header': {'msg_id': 'd9dc144a-d86c-42c1-8bab-f8a6bc525723',\n", | |||
|
701 | " 'msg_type': 'stream',\n", | |||
|
702 | " 'session': '9b9408d8-7420-4e0c-976d-cdda9f8d2564',\n", | |||
|
703 | " 'username': 'kernel'},\n", | |||
|
704 | " 'metadata': {},\n", | |||
|
705 | " 'msg_id': 'd9dc144a-d86c-42c1-8bab-f8a6bc525723',\n", | |||
|
706 | " 'msg_type': 'stream',\n", | |||
|
707 | " 'parent_header': {'msg_id': '3DBB06AD83C942DD85DC6477B08F1FBF',\n", | |||
|
708 | " 'msg_type': 'comm_msg',\n", | |||
|
709 | " 'session': '0F6D6BE728DA47A38CFC4BDEACF34FC4',\n", | |||
|
710 | " 'username': 'username'}}" | |||
|
711 | ] | |||
|
712 | } | |||
|
713 | ], | |||
|
714 | "prompt_number": 11 | |||
|
715 | }, | |||
|
716 | { | |||
|
717 | "cell_type": "code", | |||
|
718 | "collapsed": false, | |||
|
719 | "input": [ | |||
|
720 | "def show_button(sender=None):\n", | |||
|
721 | " button = widgets.ButtonWidget()\n", | |||
|
722 | " button.clicks = 0\n", | |||
|
723 | " if sender is None:\n", | |||
|
724 | " button.description = \"0\"\n", | |||
|
725 | " else:\n", | |||
|
726 | " sender.clicks += 1\n", | |||
|
727 | " button.description = \"%d\" % sender.clicks\n", | |||
|
728 | " display(button)\n", | |||
|
729 | " button.on_click(show_button)\n", | |||
|
730 | "show_button()\n", | |||
|
731 | " " | |||
|
732 | ], | |||
|
733 | "language": "python", | |||
|
734 | "metadata": {}, | |||
|
735 | "outputs": [], | |||
|
736 | "prompt_number": 9 | |||
466 | }, |
|
737 | }, | |
467 | { |
|
738 | { | |
468 | "cell_type": "code", |
|
739 | "cell_type": "code", |
@@ -17,6 +17,9 b'' | |||||
17 | "cell_type": "code", |
|
17 | "cell_type": "code", | |
18 | "collapsed": false, |
|
18 | "collapsed": false, | |
19 | "input": [ |
|
19 | "input": [ | |
|
20 | "\n", | |||
|
21 | "\n", | |||
|
22 | "\n", | |||
20 | "from IPython.html import widgets # Widget definitions\n", |
|
23 | "from IPython.html import widgets # Widget definitions\n", | |
21 | "from IPython.display import display # Used to display widgets in the notebook" |
|
24 | "from IPython.display import display # Used to display widgets in the notebook" | |
22 | ], |
|
25 | ], | |
@@ -50,7 +53,7 b'' | |||||
50 | "floatrange = widgets.FloatRangeWidget() # You can set the parent in the constructor,\n", |
|
53 | "floatrange = widgets.FloatRangeWidget() # You can set the parent in the constructor,\n", | |
51 | "\n", |
|
54 | "\n", | |
52 | "string = widgets.StringWidget(value='hi')\n", |
|
55 | "string = widgets.StringWidget(value='hi')\n", | |
53 |
"container = widgets. |
|
56 | "container = widgets.ContainerWidget(children=[floatrange, string])\n", | |
54 | "\n", |
|
57 | "\n", | |
55 | "display(container) # Displays the `container` and all of it's children." |
|
58 | "display(container) # Displays the `container` and all of it's children." | |
56 | ], |
|
59 | ], | |
@@ -72,15 +75,15 b'' | |||||
72 | "cell_type": "code", |
|
75 | "cell_type": "code", | |
73 | "collapsed": false, |
|
76 | "collapsed": false, | |
74 | "input": [ |
|
77 | "input": [ | |
75 |
" |
|
78 | "intrange = widgets.IntRangeWidget() # Never gets displayed.\n", | |
76 | "display(container)\n", |
|
79 | "container = widgets.MulticontainerWidget(children=[intrange])\n", | |
77 | "\n", |
|
80 | "\n", | |
78 | "intrange = widgets.IntRangeWidget(parent=container) # Never gets displayed." |
|
81 | "display(container)\n" | |
79 | ], |
|
82 | ], | |
80 | "language": "python", |
|
83 | "language": "python", | |
81 | "metadata": {}, |
|
84 | "metadata": {}, | |
82 | "outputs": [], |
|
85 | "outputs": [], | |
83 |
"prompt_number": |
|
86 | "prompt_number": 5 | |
84 | }, |
|
87 | }, | |
85 | { |
|
88 | { | |
86 | "cell_type": "markdown", |
|
89 | "cell_type": "markdown", | |
@@ -123,20 +126,18 b'' | |||||
123 | "cell_type": "code", |
|
126 | "cell_type": "code", | |
124 | "collapsed": false, |
|
127 | "collapsed": false, | |
125 | "input": [ |
|
128 | "input": [ | |
126 | "container = widgets.MulticontainerWidget()\n", |
|
|||
127 | "\n", |
|
129 | "\n", | |
128 |
"floatrange = widgets.FloatRangeWidget( |
|
130 | "floatrange = widgets.FloatRangeWidget()\n", | |
129 | "floatrange.default_view_name = \"FloatTextView\" # It can be set as a property.\n", |
|
131 | "floatrange.default_view_name = \"FloatTextView\" # It can be set as a property.\n", | |
130 | "\n", |
|
132 | "\n", | |
131 | "string = widgets.StringWidget(default_view_name = \"TextAreaView\") # It can also be set in the constructor.\n", |
|
133 | "string = widgets.StringWidget(default_view_name = \"TextAreaView\") # It can also be set in the constructor.\n", | |
132 | "string.parent = container\n", |
|
134 | "container = widgets.MulticontainerWidget(children=[floatrange, string])\n", | |
133 | "\n", |
|
|||
134 | "display(container)" |
|
135 | "display(container)" | |
135 | ], |
|
136 | ], | |
136 | "language": "python", |
|
137 | "language": "python", | |
137 | "metadata": {}, |
|
138 | "metadata": {}, | |
138 | "outputs": [], |
|
139 | "outputs": [], | |
139 |
"prompt_number": |
|
140 | "prompt_number": 6 | |
140 | }, |
|
141 | }, | |
141 | { |
|
142 | { | |
142 | "cell_type": "markdown", |
|
143 | "cell_type": "markdown", | |
@@ -190,18 +191,8 b'' | |||||
190 | ], |
|
191 | ], | |
191 | "language": "python", |
|
192 | "language": "python", | |
192 | "metadata": {}, |
|
193 | "metadata": {}, | |
193 | "outputs": [ |
|
194 | "outputs": [], | |
194 | { |
|
195 | "prompt_number": 7 | |
195 | "output_type": "stream", |
|
|||
196 | "stream": "stdout", |
|
|||
197 | "text": [ |
|
|||
198 | "['visible', '_css', '_children_attr', '_children_lists_attr', 'default_view_name', 'value', 'disabled', 'description']\n", |
|
|||
199 | "[]\n", |
|
|||
200 | "[]\n" |
|
|||
201 | ] |
|
|||
202 | } |
|
|||
203 | ], |
|
|||
204 | "prompt_number": 11 |
|
|||
205 | }, |
|
196 | }, | |
206 | { |
|
197 | { | |
207 | "cell_type": "code", |
|
198 | "cell_type": "code", | |
@@ -212,7 +203,7 b'' | |||||
212 | "language": "python", |
|
203 | "language": "python", | |
213 | "metadata": {}, |
|
204 | "metadata": {}, | |
214 | "outputs": [], |
|
205 | "outputs": [], | |
215 |
"prompt_number": |
|
206 | "prompt_number": 8 | |
216 | }, |
|
207 | }, | |
217 | { |
|
208 | { | |
218 | "cell_type": "code", |
|
209 | "cell_type": "code", | |
@@ -223,7 +214,7 b'' | |||||
223 | "language": "python", |
|
214 | "language": "python", | |
224 | "metadata": {}, |
|
215 | "metadata": {}, | |
225 | "outputs": [], |
|
216 | "outputs": [], | |
226 |
"prompt_number": |
|
217 | "prompt_number": 9 | |
227 | }, |
|
218 | }, | |
228 | { |
|
219 | { | |
229 | "cell_type": "markdown", |
|
220 | "cell_type": "markdown", | |
@@ -319,13 +310,6 b'' | |||||
319 | "text": [ |
|
310 | "text": [ | |
320 | "False\n" |
|
311 | "False\n" | |
321 | ] |
|
312 | ] | |
322 | }, |
|
|||
323 | { |
|
|||
324 | "output_type": "stream", |
|
|||
325 | "stream": "stdout", |
|
|||
326 | "text": [ |
|
|||
327 | "True\n" |
|
|||
328 | ] |
|
|||
329 | } |
|
313 | } | |
330 | ], |
|
314 | ], | |
331 | "prompt_number": 2 |
|
315 | "prompt_number": 2 |
@@ -53,7 +53,7 b'' | |||||
53 | "output_type": "stream", |
|
53 | "output_type": "stream", | |
54 | "stream": "stdout", |
|
54 | "stream": "stdout", | |
55 | "text": [ |
|
55 | "text": [ | |
56 |
"Set one or more CSS properties of the widget (shared among all of the |
|
56 | "Set one or more CSS properties of the widget (shared among all of the\n", | |
57 | " views). This function has two signatures:\n", |
|
57 | " views). This function has two signatures:\n", | |
58 | " - set_css(css_dict, [selector=''])\n", |
|
58 | " - set_css(css_dict, [selector=''])\n", | |
59 | " - set_css(key, value, [selector=''])\n", |
|
59 | " - set_css(key, value, [selector=''])\n", | |
@@ -94,8 +94,8 b'' | |||||
94 | "output_type": "stream", |
|
94 | "output_type": "stream", | |
95 | "stream": "stdout", |
|
95 | "stream": "stdout", | |
96 | "text": [ |
|
96 | "text": [ | |
97 |
"Get a CSS property of the widget. Note, this function does not |
|
97 | "Get a CSS property of the widget. Note, this function does not\n", | |
98 |
" actually request the CSS from the front-end; Only properties that have |
|
98 | " actually request the CSS from the front-end; Only properties that have\n", | |
99 | " been set with set_css can be read.\n", |
|
99 | " been set with set_css can be read.\n", | |
100 | "\n", |
|
100 | "\n", | |
101 | " Parameters\n", |
|
101 | " Parameters\n", | |
@@ -121,7 +121,9 b'' | |||||
121 | "cell_type": "code", |
|
121 | "cell_type": "code", | |
122 | "collapsed": false, |
|
122 | "collapsed": false, | |
123 | "input": [ |
|
123 | "input": [ | |
124 | "container = widgets.ContainerWidget()\n", |
|
124 | "label = widgets.StringWidget(default_view_name=\"HTMLView\")\n", | |
|
125 | "label.value = \"<strong>ALERT: </strong> Hello World!\"\n", | |||
|
126 | "container = widgets.ContainerWidget(children=[label])\n", | |||
125 | "\n", |
|
127 | "\n", | |
126 | "# set_css used to set a single CSS attribute.\n", |
|
128 | "# set_css used to set a single CSS attribute.\n", | |
127 | "container.set_css('border', '3px solid black') # Border the container\n", |
|
129 | "container.set_css('border', '3px solid black') # Border the container\n", | |
@@ -130,9 +132,6 b'' | |||||
130 | "container.set_css({'padding': '6px', # Add padding to the container\n", |
|
132 | "container.set_css({'padding': '6px', # Add padding to the container\n", | |
131 | " 'background': 'yellow'}) # Fill the container yellow\n", |
|
133 | " 'background': 'yellow'}) # Fill the container yellow\n", | |
132 | "\n", |
|
134 | "\n", | |
133 | "label = widgets.StringWidget(default_view_name=\"HTMLView\", parent=container)\n", |
|
|||
134 | "label.value = \"<strong>ALERT: </strong> Hello World!\"\n", |
|
|||
135 | "\n", |
|
|||
136 | "display(container)" |
|
135 | "display(container)" | |
137 | ], |
|
136 | ], | |
138 | "language": "python", |
|
137 | "language": "python", | |
@@ -173,10 +172,10 b'' | |||||
173 | " Parameters\n", |
|
172 | " Parameters\n", | |
174 | " ----------\n", |
|
173 | " ----------\n", | |
175 | " class_name: unicode\n", |
|
174 | " class_name: unicode\n", | |
176 |
" Class name(s) to add to the DOM element(s). Multiple class names |
|
175 | " Class name(s) to add to the DOM element(s). Multiple class names\n", | |
177 | " must be space separated.\n", |
|
176 | " must be space separated.\n", | |
178 | " selector: unicode (optional)\n", |
|
177 | " selector: unicode (optional)\n", | |
179 |
" JQuery selector to select the DOM element(s) that the class(es) will |
|
178 | " JQuery selector to select the DOM element(s) that the class(es) will\n", | |
180 | " be added to.\n", |
|
179 | " be added to.\n", | |
181 | " \n" |
|
180 | " \n" | |
182 | ] |
|
181 | ] | |
@@ -200,16 +199,16 b'' | |||||
200 | " 'padding': '6px', \n", |
|
199 | " 'padding': '6px', \n", | |
201 | " 'background': 'yellow'}) \n", |
|
200 | " 'background': 'yellow'}) \n", | |
202 | "\n", |
|
201 | "\n", | |
203 |
"label = widgets.StringWidget(default_view_name=\"HTMLView\" |
|
202 | "label = widgets.StringWidget(default_view_name=\"HTMLView\")\n", | |
204 | "label.value = \"<strong>ALERT: </strong> Hello World!\"\n", |
|
203 | "label.value = \"<strong>ALERT: </strong> Hello World!\"\n", | |
205 | "\n", |
|
204 | "container.children = [label]\n", | |
206 | "display(container)\n", |
|
205 | "display(container)\n", | |
207 | "container.add_class('corner-all') # Must be called AFTER display" |
|
206 | "container.add_class('corner-all') # Must be called AFTER display" | |
208 | ], |
|
207 | ], | |
209 | "language": "python", |
|
208 | "language": "python", | |
210 | "metadata": {}, |
|
209 | "metadata": {}, | |
211 | "outputs": [], |
|
210 | "outputs": [], | |
212 |
"prompt_number": |
|
211 | "prompt_number": 7 | |
213 | }, |
|
212 | }, | |
214 | { |
|
213 | { | |
215 | "cell_type": "markdown", |
|
214 | "cell_type": "markdown", | |
@@ -231,7 +230,7 b'' | |||||
231 | "language": "python", |
|
230 | "language": "python", | |
232 | "metadata": {}, |
|
231 | "metadata": {}, | |
233 | "outputs": [], |
|
232 | "outputs": [], | |
234 |
"prompt_number": |
|
233 | "prompt_number": 11 | |
235 | }, |
|
234 | }, | |
236 | { |
|
235 | { | |
237 | "cell_type": "markdown", |
|
236 | "cell_type": "markdown", | |
@@ -261,7 +260,7 b'' | |||||
261 | "language": "python", |
|
260 | "language": "python", | |
262 | "metadata": {}, |
|
261 | "metadata": {}, | |
263 | "outputs": [], |
|
262 | "outputs": [], | |
264 |
"prompt_number": |
|
263 | "prompt_number": 12 | |
265 | }, |
|
264 | }, | |
266 | { |
|
265 | { | |
267 | "cell_type": "markdown", |
|
266 | "cell_type": "markdown", | |
@@ -288,16 +287,16 b'' | |||||
288 | " Parameters\n", |
|
287 | " Parameters\n", | |
289 | " ----------\n", |
|
288 | " ----------\n", | |
290 | " class_name: unicode\n", |
|
289 | " class_name: unicode\n", | |
291 |
" Class name(s) to remove from the DOM element(s). Multiple class |
|
290 | " Class name(s) to remove from the DOM element(s). Multiple class\n", | |
292 | " names must be space separated.\n", |
|
291 | " names must be space separated.\n", | |
293 | " selector: unicode (optional)\n", |
|
292 | " selector: unicode (optional)\n", | |
294 |
" JQuery selector to select the DOM element(s) that the class(es) will |
|
293 | " JQuery selector to select the DOM element(s) that the class(es) will\n", | |
295 | " be removed from.\n", |
|
294 | " be removed from.\n", | |
296 | " \n" |
|
295 | " \n" | |
297 | ] |
|
296 | ] | |
298 | } |
|
297 | } | |
299 | ], |
|
298 | ], | |
300 |
"prompt_number": |
|
299 | "prompt_number": 13 | |
301 | }, |
|
300 | }, | |
302 | { |
|
301 | { | |
303 | "cell_type": "markdown", |
|
302 | "cell_type": "markdown", | |
@@ -328,7 +327,15 b'' | |||||
328 | "language": "python", |
|
327 | "language": "python", | |
329 | "metadata": {}, |
|
328 | "metadata": {}, | |
330 | "outputs": [], |
|
329 | "outputs": [], | |
331 |
"prompt_number": 1 |
|
330 | "prompt_number": 14 | |
|
331 | }, | |||
|
332 | { | |||
|
333 | "cell_type": "code", | |||
|
334 | "collapsed": false, | |||
|
335 | "input": [], | |||
|
336 | "language": "python", | |||
|
337 | "metadata": {}, | |||
|
338 | "outputs": [] | |||
332 | } |
|
339 | } | |
333 | ], |
|
340 | ], | |
334 | "metadata": {} |
|
341 | "metadata": {} |
@@ -132,9 +132,9 b'' | |||||
132 | "def fill_container(container):\n", |
|
132 | "def fill_container(container):\n", | |
133 | " components = []\n", |
|
133 | " components = []\n", | |
134 | " for i in range(3):\n", |
|
134 | " for i in range(3):\n", | |
135 |
" components.append(widgets.StringWidget( |
|
135 | " components.append(widgets.StringWidget(default_view_name='HTMLView', value=\"ABC\"[i]))\n", | |
136 | " components[i].set_css(child_style)\n", |
|
136 | " components[i].set_css(child_style)\n", | |
137 |
" |
|
137 | " container.children = components\n", | |
138 | " \n", |
|
138 | " \n", | |
139 | "container = make_container('VBox')\n", |
|
139 | "container = make_container('VBox')\n", | |
140 | "container.vbox()\n", |
|
140 | "container.vbox()\n", | |
@@ -205,7 +205,7 b'' | |||||
205 | " components[i].flex1()\n", |
|
205 | " components[i].flex1()\n", | |
206 | " elif flexes[i] == 2:\n", |
|
206 | " elif flexes[i] == 2:\n", | |
207 | " components[i].flex2()\n", |
|
207 | " components[i].flex2()\n", | |
208 |
" |
|
208 | " container.children = components\n", | |
209 | " \n", |
|
209 | " \n", | |
210 | "container = make_container('Different Flex Configurations')\n", |
|
210 | "container = make_container('Different Flex Configurations')\n", | |
211 | "container.hbox()\n", |
|
211 | "container.hbox()\n", | |
@@ -234,7 +234,7 b'' | |||||
234 | "language": "python", |
|
234 | "language": "python", | |
235 | "metadata": {}, |
|
235 | "metadata": {}, | |
236 | "outputs": [], |
|
236 | "outputs": [], | |
237 |
"prompt_number": |
|
237 | "prompt_number": 8 | |
238 | }, |
|
238 | }, | |
239 | { |
|
239 | { | |
240 | "cell_type": "markdown", |
|
240 | "cell_type": "markdown", | |
@@ -253,7 +253,7 b'' | |||||
253 | " components.append(widgets.StringWidget(parent=container, default_view_name='HTMLView', value=\"ABC\"[i]))\n", |
|
253 | " components.append(widgets.StringWidget(parent=container, default_view_name='HTMLView', value=\"ABC\"[i]))\n", | |
254 | " components[i].set_css(child_style)\n", |
|
254 | " components[i].set_css(child_style)\n", | |
255 | " components[i].set_css('height', str((i+1) * 50) + 'px')\n", |
|
255 | " components[i].set_css('height', str((i+1) * 50) + 'px')\n", | |
256 |
" |
|
256 | " container.children = components\n", | |
257 | "\n", |
|
257 | "\n", | |
258 | "container = make_container('HBox Align Start')\n", |
|
258 | "container = make_container('HBox Align Start')\n", | |
259 | "container.hbox()\n", |
|
259 | "container.hbox()\n", | |
@@ -273,7 +273,7 b'' | |||||
273 | "language": "python", |
|
273 | "language": "python", | |
274 | "metadata": {}, |
|
274 | "metadata": {}, | |
275 | "outputs": [], |
|
275 | "outputs": [], | |
276 |
"prompt_number": |
|
276 | "prompt_number": 9 | |
277 | }, |
|
277 | }, | |
278 | { |
|
278 | { | |
279 | "cell_type": "markdown", |
|
279 | "cell_type": "markdown", | |
@@ -288,14 +288,22 b'' | |||||
288 | "input": [ |
|
288 | "input": [ | |
289 | "container = widgets.ContainerWidget()\n", |
|
289 | "container = widgets.ContainerWidget()\n", | |
290 | "container.hbox()\n", |
|
290 | "container.hbox()\n", | |
291 | "for i in range(15):\n", |
|
291 | "container.children=[widgets.FloatRangeWidget(orientation='vertical', description=str(i+1), value=50.0) \n", | |
292 | " widgets.FloatRangeWidget(orientation='vertical', parent=container, description=str(i+1), value=50.0)\n", |
|
292 | " for i in range(15)]\n", | |
293 | "display(container)" |
|
293 | "display(container)" | |
294 | ], |
|
294 | ], | |
295 | "language": "python", |
|
295 | "language": "python", | |
296 | "metadata": {}, |
|
296 | "metadata": {}, | |
297 | "outputs": [], |
|
297 | "outputs": [], | |
298 |
"prompt_number": |
|
298 | "prompt_number": 11 | |
|
299 | }, | |||
|
300 | { | |||
|
301 | "cell_type": "code", | |||
|
302 | "collapsed": false, | |||
|
303 | "input": [], | |||
|
304 | "language": "python", | |||
|
305 | "metadata": {}, | |||
|
306 | "outputs": [] | |||
299 | } |
|
307 | } | |
300 | ], |
|
308 | ], | |
301 | "metadata": {} |
|
309 | "metadata": {} |
@@ -37,7 +37,7 b'' | |||||
37 | "language": "python", |
|
37 | "language": "python", | |
38 | "metadata": {}, |
|
38 | "metadata": {}, | |
39 | "outputs": [], |
|
39 | "outputs": [], | |
40 | "prompt_number": 1 |
|
40 | "prompt_number": 15 | |
41 | }, |
|
41 | }, | |
42 | { |
|
42 | { | |
43 | "cell_type": "markdown", |
|
43 | "cell_type": "markdown", | |
@@ -56,7 +56,7 b'' | |||||
56 | "language": "python", |
|
56 | "language": "python", | |
57 | "metadata": {}, |
|
57 | "metadata": {}, | |
58 | "outputs": [], |
|
58 | "outputs": [], | |
59 |
"prompt_number": |
|
59 | "prompt_number": 16 | |
60 | }, |
|
60 | }, | |
61 | { |
|
61 | { | |
62 | "cell_type": "heading", |
|
62 | "cell_type": "heading", | |
@@ -112,7 +112,7 b'' | |||||
112 | "language": "python", |
|
112 | "language": "python", | |
113 | "metadata": {}, |
|
113 | "metadata": {}, | |
114 | "outputs": [], |
|
114 | "outputs": [], | |
115 |
"prompt_number": |
|
115 | "prompt_number": 17 | |
116 | }, |
|
116 | }, | |
117 | { |
|
117 | { | |
118 | "cell_type": "markdown", |
|
118 | "cell_type": "markdown", | |
@@ -143,7 +143,7 b'' | |||||
143 | "input": [ |
|
143 | "input": [ | |
144 | "%%javascript\n", |
|
144 | "%%javascript\n", | |
145 | "\n", |
|
145 | "\n", | |
146 | "require([\"notebook/js/widget\"], function(){\n", |
|
146 | "require([\"notebook/js/widgets/\"], function(){\n", | |
147 | "\n", |
|
147 | "\n", | |
148 | "});" |
|
148 | "});" | |
149 | ], |
|
149 | ], | |
@@ -160,11 +160,11 b'' | |||||
160 | "metadata": {}, |
|
160 | "metadata": {}, | |
161 | "output_type": "display_data", |
|
161 | "output_type": "display_data", | |
162 | "text": [ |
|
162 | "text": [ | |
163 |
"<IPython.core.display.Javascript at 0x |
|
163 | "<IPython.core.display.Javascript at 0x10a26a850>" | |
164 | ] |
|
164 | ] | |
165 | } |
|
165 | } | |
166 | ], |
|
166 | ], | |
167 |
"prompt_number": |
|
167 | "prompt_number": 18 | |
168 | }, |
|
168 | }, | |
169 | { |
|
169 | { | |
170 | "cell_type": "markdown", |
|
170 | "cell_type": "markdown", | |
@@ -179,7 +179,7 b'' | |||||
179 | "input": [ |
|
179 | "input": [ | |
180 | "%%javascript\n", |
|
180 | "%%javascript\n", | |
181 | "\n", |
|
181 | "\n", | |
182 | "require([\"notebook/js/widget\"], function(){\n", |
|
182 | "require([\"notebook/js/widgets/base\"], function(){\n", | |
183 | " \n", |
|
183 | " \n", | |
184 | " // Define the DateModel and register it with the widget manager.\n", |
|
184 | " // Define the DateModel and register it with the widget manager.\n", | |
185 | " var DateModel = IPython.WidgetModel.extend({});\n", |
|
185 | " var DateModel = IPython.WidgetModel.extend({});\n", | |
@@ -192,7 +192,7 b'' | |||||
192 | { |
|
192 | { | |
193 | "javascript": [ |
|
193 | "javascript": [ | |
194 | "\n", |
|
194 | "\n", | |
195 | "require([\"notebook/js/widget\"], function(){\n", |
|
195 | "require([\"notebook/js/widgets/base\"], function(){\n", | |
196 | " \n", |
|
196 | " \n", | |
197 | " // Define the DateModel and register it with the widget manager.\n", |
|
197 | " // Define the DateModel and register it with the widget manager.\n", | |
198 | " var DateModel = IPython.WidgetModel.extend({});\n", |
|
198 | " var DateModel = IPython.WidgetModel.extend({});\n", | |
@@ -202,11 +202,11 b'' | |||||
202 | "metadata": {}, |
|
202 | "metadata": {}, | |
203 | "output_type": "display_data", |
|
203 | "output_type": "display_data", | |
204 | "text": [ |
|
204 | "text": [ | |
205 |
"<IPython.core.display.Javascript at 0x |
|
205 | "<IPython.core.display.Javascript at 0x10a26aa10>" | |
206 | ] |
|
206 | ] | |
207 | } |
|
207 | } | |
208 | ], |
|
208 | ], | |
209 |
"prompt_number": |
|
209 | "prompt_number": 20 | |
210 | }, |
|
210 | }, | |
211 | { |
|
211 | { | |
212 | "cell_type": "markdown", |
|
212 | "cell_type": "markdown", | |
@@ -223,7 +223,7 b'' | |||||
223 | "input": [ |
|
223 | "input": [ | |
224 | "%%javascript\n", |
|
224 | "%%javascript\n", | |
225 | "\n", |
|
225 | "\n", | |
226 | "require([\"notebook/js/widget\"], function(){\n", |
|
226 | "require([\"notebook/js/widgets/base\"], function(){\n", | |
227 | " \n", |
|
227 | " \n", | |
228 | " // Define the DateModel and register it with the widget manager.\n", |
|
228 | " // Define the DateModel and register it with the widget manager.\n", | |
229 | " var DateModel = IPython.WidgetModel.extend({});\n", |
|
229 | " var DateModel = IPython.WidgetModel.extend({});\n", | |
@@ -248,7 +248,7 b'' | |||||
248 | { |
|
248 | { | |
249 | "javascript": [ |
|
249 | "javascript": [ | |
250 | "\n", |
|
250 | "\n", | |
251 | "require([\"notebook/js/widget\"], function(){\n", |
|
251 | "require([\"notebook/js/widgets/base\"], function(){\n", | |
252 | " \n", |
|
252 | " \n", | |
253 | " // Define the DateModel and register it with the widget manager.\n", |
|
253 | " // Define the DateModel and register it with the widget manager.\n", | |
254 | " var DateModel = IPython.WidgetModel.extend({});\n", |
|
254 | " var DateModel = IPython.WidgetModel.extend({});\n", | |
@@ -270,11 +270,11 b'' | |||||
270 | "metadata": {}, |
|
270 | "metadata": {}, | |
271 | "output_type": "display_data", |
|
271 | "output_type": "display_data", | |
272 | "text": [ |
|
272 | "text": [ | |
273 |
"<IPython.core.display.Javascript at 0x |
|
273 | "<IPython.core.display.Javascript at 0x10a26ae90>" | |
274 | ] |
|
274 | ] | |
275 | } |
|
275 | } | |
276 | ], |
|
276 | ], | |
277 |
"prompt_number": |
|
277 | "prompt_number": 23 | |
278 | }, |
|
278 | }, | |
279 | { |
|
279 | { | |
280 | "cell_type": "heading", |
|
280 | "cell_type": "heading", | |
@@ -301,7 +301,7 b'' | |||||
301 | "language": "python", |
|
301 | "language": "python", | |
302 | "metadata": {}, |
|
302 | "metadata": {}, | |
303 | "outputs": [], |
|
303 | "outputs": [], | |
304 |
"prompt_number": |
|
304 | "prompt_number": 24 | |
305 | }, |
|
305 | }, | |
306 | { |
|
306 | { | |
307 | "cell_type": "heading", |
|
307 | "cell_type": "heading", | |
@@ -346,7 +346,7 b'' | |||||
346 | "language": "python", |
|
346 | "language": "python", | |
347 | "metadata": {}, |
|
347 | "metadata": {}, | |
348 | "outputs": [], |
|
348 | "outputs": [], | |
349 |
"prompt_number": |
|
349 | "prompt_number": 25 | |
350 | }, |
|
350 | }, | |
351 | { |
|
351 | { | |
352 | "cell_type": "heading", |
|
352 | "cell_type": "heading", | |
@@ -369,7 +369,7 b'' | |||||
369 | "input": [ |
|
369 | "input": [ | |
370 | "%%javascript\n", |
|
370 | "%%javascript\n", | |
371 | "\n", |
|
371 | "\n", | |
372 | "require([\"notebook/js/widget\"], function(){\n", |
|
372 | "require([\"notebook/js/widgets/base\"], function(){\n", | |
373 | " \n", |
|
373 | " \n", | |
374 | " // Define the DateModel and register it with the widget manager.\n", |
|
374 | " // Define the DateModel and register it with the widget manager.\n", | |
375 | " var DateModel = IPython.WidgetModel.extend({});\n", |
|
375 | " var DateModel = IPython.WidgetModel.extend({});\n", | |
@@ -399,7 +399,7 b'' | |||||
399 | { |
|
399 | { | |
400 | "javascript": [ |
|
400 | "javascript": [ | |
401 | "\n", |
|
401 | "\n", | |
402 | "require([\"notebook/js/widget\"], function(){\n", |
|
402 | "require([\"notebook/js/widgets/base\"], function(){\n", | |
403 | " \n", |
|
403 | " \n", | |
404 | " // Define the DateModel and register it with the widget manager.\n", |
|
404 | " // Define the DateModel and register it with the widget manager.\n", | |
405 | " var DateModel = IPython.WidgetModel.extend({});\n", |
|
405 | " var DateModel = IPython.WidgetModel.extend({});\n", | |
@@ -426,11 +426,11 b'' | |||||
426 | "metadata": {}, |
|
426 | "metadata": {}, | |
427 | "output_type": "display_data", |
|
427 | "output_type": "display_data", | |
428 | "text": [ |
|
428 | "text": [ | |
429 |
"<IPython.core.display.Javascript at 0x |
|
429 | "<IPython.core.display.Javascript at 0x10a274050>" | |
430 | ] |
|
430 | ] | |
431 | } |
|
431 | } | |
432 | ], |
|
432 | ], | |
433 |
"prompt_number": |
|
433 | "prompt_number": 26 | |
434 | }, |
|
434 | }, | |
435 | { |
|
435 | { | |
436 | "cell_type": "markdown", |
|
436 | "cell_type": "markdown", | |
@@ -445,7 +445,7 b'' | |||||
445 | "input": [ |
|
445 | "input": [ | |
446 | "%%javascript\n", |
|
446 | "%%javascript\n", | |
447 | "\n", |
|
447 | "\n", | |
448 | "require([\"notebook/js/widget\"], function(){\n", |
|
448 | "require([\"notebook/js/widgets/base\"], function(){\n", | |
449 | " \n", |
|
449 | " \n", | |
450 | " // Define the DateModel and register it with the widget manager.\n", |
|
450 | " // Define the DateModel and register it with the widget manager.\n", | |
451 | " var DateModel = IPython.WidgetModel.extend({});\n", |
|
451 | " var DateModel = IPython.WidgetModel.extend({});\n", | |
@@ -482,7 +482,7 b'' | |||||
482 | { |
|
482 | { | |
483 | "javascript": [ |
|
483 | "javascript": [ | |
484 | "\n", |
|
484 | "\n", | |
485 | "require([\"notebook/js/widget\"], function(){\n", |
|
485 | "require([\"notebook/js/widgets/base\"], function(){\n", | |
486 | " \n", |
|
486 | " \n", | |
487 | " // Define the DateModel and register it with the widget manager.\n", |
|
487 | " // Define the DateModel and register it with the widget manager.\n", | |
488 | " var DateModel = IPython.WidgetModel.extend({});\n", |
|
488 | " var DateModel = IPython.WidgetModel.extend({});\n", | |
@@ -516,11 +516,11 b'' | |||||
516 | "metadata": {}, |
|
516 | "metadata": {}, | |
517 | "output_type": "display_data", |
|
517 | "output_type": "display_data", | |
518 | "text": [ |
|
518 | "text": [ | |
519 |
"<IPython.core.display.Javascript at 0x |
|
519 | "<IPython.core.display.Javascript at 0x10a2740d0>" | |
520 | ] |
|
520 | ] | |
521 | } |
|
521 | } | |
522 | ], |
|
522 | ], | |
523 |
"prompt_number": |
|
523 | "prompt_number": 27 | |
524 | }, |
|
524 | }, | |
525 | { |
|
525 | { | |
526 | "cell_type": "markdown", |
|
526 | "cell_type": "markdown", | |
@@ -539,7 +539,7 b'' | |||||
539 | "input": [ |
|
539 | "input": [ | |
540 | "%%javascript\n", |
|
540 | "%%javascript\n", | |
541 | "\n", |
|
541 | "\n", | |
542 | "require([\"notebook/js/widget\"], function(){\n", |
|
542 | "require([\"notebook/js/widgets/base\"], function(){\n", | |
543 | " \n", |
|
543 | " \n", | |
544 | " // Define the DateModel and register it with the widget manager.\n", |
|
544 | " // Define the DateModel and register it with the widget manager.\n", | |
545 | " var DateModel = IPython.WidgetModel.extend({});\n", |
|
545 | " var DateModel = IPython.WidgetModel.extend({});\n", | |
@@ -573,7 +573,6 b'' | |||||
573 | " // Callback for when the date is changed.\n", |
|
573 | " // Callback for when the date is changed.\n", | |
574 | " handle_date_change: function(event) {\n", |
|
574 | " handle_date_change: function(event) {\n", | |
575 | " this.model.set('value', this.$date.val());\n", |
|
575 | " this.model.set('value', this.$date.val());\n", | |
576 | " this.model.update_other_views(this);\n", |
|
|||
577 | " },\n", |
|
576 | " },\n", | |
578 | " \n", |
|
577 | " \n", | |
579 | " });\n", |
|
578 | " });\n", | |
@@ -588,7 +587,7 b'' | |||||
588 | { |
|
587 | { | |
589 | "javascript": [ |
|
588 | "javascript": [ | |
590 | "\n", |
|
589 | "\n", | |
591 | "require([\"notebook/js/widget\"], function(){\n", |
|
590 | "require([\"notebook/js/widgets/base\"], function(){\n", | |
592 | " \n", |
|
591 | " \n", | |
593 | " // Define the DateModel and register it with the widget manager.\n", |
|
592 | " // Define the DateModel and register it with the widget manager.\n", | |
594 | " var DateModel = IPython.WidgetModel.extend({});\n", |
|
593 | " var DateModel = IPython.WidgetModel.extend({});\n", | |
@@ -622,7 +621,6 b'' | |||||
622 | " // Callback for when the date is changed.\n", |
|
621 | " // Callback for when the date is changed.\n", | |
623 | " handle_date_change: function(event) {\n", |
|
622 | " handle_date_change: function(event) {\n", | |
624 | " this.model.set('value', this.$date.val());\n", |
|
623 | " this.model.set('value', this.$date.val());\n", | |
625 | " this.model.update_other_views(this);\n", |
|
|||
626 | " },\n", |
|
624 | " },\n", | |
627 | " \n", |
|
625 | " \n", | |
628 | " });\n", |
|
626 | " });\n", | |
@@ -634,11 +632,11 b'' | |||||
634 | "metadata": {}, |
|
632 | "metadata": {}, | |
635 | "output_type": "display_data", |
|
633 | "output_type": "display_data", | |
636 | "text": [ |
|
634 | "text": [ | |
637 |
"<IPython.core.display.Javascript at 0x |
|
635 | "<IPython.core.display.Javascript at 0x10a274a10>" | |
638 | ] |
|
636 | ] | |
639 | } |
|
637 | } | |
640 | ], |
|
638 | ], | |
641 |
"prompt_number": |
|
639 | "prompt_number": 52 | |
642 | }, |
|
640 | }, | |
643 | { |
|
641 | { | |
644 | "cell_type": "heading", |
|
642 | "cell_type": "heading", | |
@@ -665,7 +663,7 b'' | |||||
665 | "language": "python", |
|
663 | "language": "python", | |
666 | "metadata": {}, |
|
664 | "metadata": {}, | |
667 | "outputs": [], |
|
665 | "outputs": [], | |
668 |
"prompt_number": |
|
666 | "prompt_number": 29 | |
669 | }, |
|
667 | }, | |
670 | { |
|
668 | { | |
671 | "cell_type": "markdown", |
|
669 | "cell_type": "markdown", | |
@@ -683,7 +681,7 b'' | |||||
683 | "language": "python", |
|
681 | "language": "python", | |
684 | "metadata": {}, |
|
682 | "metadata": {}, | |
685 | "outputs": [], |
|
683 | "outputs": [], | |
686 |
"prompt_number": |
|
684 | "prompt_number": 30 | |
687 | }, |
|
685 | }, | |
688 | { |
|
686 | { | |
689 | "cell_type": "markdown", |
|
687 | "cell_type": "markdown", | |
@@ -704,13 +702,13 b'' | |||||
704 | { |
|
702 | { | |
705 | "metadata": {}, |
|
703 | "metadata": {}, | |
706 | "output_type": "pyout", |
|
704 | "output_type": "pyout", | |
707 |
"prompt_number": |
|
705 | "prompt_number": 37, | |
708 | "text": [ |
|
706 | "text": [ | |
709 |
" |
|
707 | "u'1998-12-01'" | |
710 | ] |
|
708 | ] | |
711 | } |
|
709 | } | |
712 | ], |
|
710 | ], | |
713 |
"prompt_number": |
|
711 | "prompt_number": 37 | |
714 | }, |
|
712 | }, | |
715 | { |
|
713 | { | |
716 | "cell_type": "markdown", |
|
714 | "cell_type": "markdown", | |
@@ -723,12 +721,12 b'' | |||||
723 | "cell_type": "code", |
|
721 | "cell_type": "code", | |
724 | "collapsed": false, |
|
722 | "collapsed": false, | |
725 | "input": [ |
|
723 | "input": [ | |
726 |
"my_widget.value = \"199 |
|
724 | "my_widget.value = \"1998-12-01\" # December 1st, 1999" | |
727 | ], |
|
725 | ], | |
728 | "language": "python", |
|
726 | "language": "python", | |
729 | "metadata": {}, |
|
727 | "metadata": {}, | |
730 | "outputs": [], |
|
728 | "outputs": [], | |
731 |
"prompt_number": |
|
729 | "prompt_number": 34 | |
732 | }, |
|
730 | }, | |
733 | { |
|
731 | { | |
734 | "cell_type": "heading", |
|
732 | "cell_type": "heading", | |
@@ -786,7 +784,7 b'' | |||||
786 | "language": "python", |
|
784 | "language": "python", | |
787 | "metadata": {}, |
|
785 | "metadata": {}, | |
788 | "outputs": [], |
|
786 | "outputs": [], | |
789 |
"prompt_number": |
|
787 | "prompt_number": 38 | |
790 | }, |
|
788 | }, | |
791 | { |
|
789 | { | |
792 | "cell_type": "markdown", |
|
790 | "cell_type": "markdown", | |
@@ -831,7 +829,7 b'' | |||||
831 | "language": "python", |
|
829 | "language": "python", | |
832 | "metadata": {}, |
|
830 | "metadata": {}, | |
833 | "outputs": [], |
|
831 | "outputs": [], | |
834 |
"prompt_number": |
|
832 | "prompt_number": 39 | |
835 | }, |
|
833 | }, | |
836 | { |
|
834 | { | |
837 | "cell_type": "markdown", |
|
835 | "cell_type": "markdown", | |
@@ -879,7 +877,7 b'' | |||||
879 | "language": "python", |
|
877 | "language": "python", | |
880 | "metadata": {}, |
|
878 | "metadata": {}, | |
881 | "outputs": [], |
|
879 | "outputs": [], | |
882 |
"prompt_number": |
|
880 | "prompt_number": 40 | |
883 | }, |
|
881 | }, | |
884 | { |
|
882 | { | |
885 | "cell_type": "markdown", |
|
883 | "cell_type": "markdown", | |
@@ -957,7 +955,7 b'' | |||||
957 | "language": "python", |
|
955 | "language": "python", | |
958 | "metadata": {}, |
|
956 | "metadata": {}, | |
959 | "outputs": [], |
|
957 | "outputs": [], | |
960 |
"prompt_number": 1 |
|
958 | "prompt_number": 41 | |
961 | }, |
|
959 | }, | |
962 | { |
|
960 | { | |
963 | "cell_type": "heading", |
|
961 | "cell_type": "heading", | |
@@ -982,7 +980,7 b'' | |||||
982 | "input": [ |
|
980 | "input": [ | |
983 | "%%javascript\n", |
|
981 | "%%javascript\n", | |
984 | "\n", |
|
982 | "\n", | |
985 | "require([\"notebook/js/widget\"], function(){\n", |
|
983 | "require([\"notebook/js/widgets/base\"], function(){\n", | |
986 | " \n", |
|
984 | " \n", | |
987 | " // Define the DateModel and register it with the widget manager.\n", |
|
985 | " // Define the DateModel and register it with the widget manager.\n", | |
988 | " var DateModel = IPython.WidgetModel.extend({});\n", |
|
986 | " var DateModel = IPython.WidgetModel.extend({});\n", | |
@@ -1034,7 +1032,6 b'' | |||||
1034 | " // Callback for when the date is changed.\n", |
|
1032 | " // Callback for when the date is changed.\n", | |
1035 | " handle_date_change: function(event) {\n", |
|
1033 | " handle_date_change: function(event) {\n", | |
1036 | " this.model.set('value', this.$date.val());\n", |
|
1034 | " this.model.set('value', this.$date.val());\n", | |
1037 | " this.model.update_other_views(this);\n", |
|
|||
1038 | " },\n", |
|
1035 | " },\n", | |
1039 | " \n", |
|
1036 | " \n", | |
1040 | " });\n", |
|
1037 | " });\n", | |
@@ -1049,7 +1046,7 b'' | |||||
1049 | { |
|
1046 | { | |
1050 | "javascript": [ |
|
1047 | "javascript": [ | |
1051 | "\n", |
|
1048 | "\n", | |
1052 | "require([\"notebook/js/widget\"], function(){\n", |
|
1049 | "require([\"notebook/js/widgets/base\"], function(){\n", | |
1053 | " \n", |
|
1050 | " \n", | |
1054 | " // Define the DateModel and register it with the widget manager.\n", |
|
1051 | " // Define the DateModel and register it with the widget manager.\n", | |
1055 | " var DateModel = IPython.WidgetModel.extend({});\n", |
|
1052 | " var DateModel = IPython.WidgetModel.extend({});\n", | |
@@ -1101,7 +1098,6 b'' | |||||
1101 | " // Callback for when the date is changed.\n", |
|
1098 | " // Callback for when the date is changed.\n", | |
1102 | " handle_date_change: function(event) {\n", |
|
1099 | " handle_date_change: function(event) {\n", | |
1103 | " this.model.set('value', this.$date.val());\n", |
|
1100 | " this.model.set('value', this.$date.val());\n", | |
1104 | " this.model.update_other_views(this);\n", |
|
|||
1105 | " },\n", |
|
1101 | " },\n", | |
1106 | " \n", |
|
1102 | " \n", | |
1107 | " });\n", |
|
1103 | " });\n", | |
@@ -1113,11 +1109,11 b'' | |||||
1113 | "metadata": {}, |
|
1109 | "metadata": {}, | |
1114 | "output_type": "display_data", |
|
1110 | "output_type": "display_data", | |
1115 | "text": [ |
|
1111 | "text": [ | |
1116 |
"<IPython.core.display.Javascript at 0x |
|
1112 | "<IPython.core.display.Javascript at 0x10a274a10>" | |
1117 | ] |
|
1113 | ] | |
1118 | } |
|
1114 | } | |
1119 | ], |
|
1115 | ], | |
1120 |
"prompt_number": |
|
1116 | "prompt_number": 53 | |
1121 | }, |
|
1117 | }, | |
1122 | { |
|
1118 | { | |
1123 | "cell_type": "heading", |
|
1119 | "cell_type": "heading", | |
@@ -1148,7 +1144,7 b'' | |||||
1148 | "language": "python", |
|
1144 | "language": "python", | |
1149 | "metadata": {}, |
|
1145 | "metadata": {}, | |
1150 | "outputs": [], |
|
1146 | "outputs": [], | |
1151 |
"prompt_number": |
|
1147 | "prompt_number": 43 | |
1152 | }, |
|
1148 | }, | |
1153 | { |
|
1149 | { | |
1154 | "cell_type": "markdown", |
|
1150 | "cell_type": "markdown", | |
@@ -1166,7 +1162,7 b'' | |||||
1166 | "language": "python", |
|
1162 | "language": "python", | |
1167 | "metadata": {}, |
|
1163 | "metadata": {}, | |
1168 | "outputs": [], |
|
1164 | "outputs": [], | |
1169 |
"prompt_number": |
|
1165 | "prompt_number": 44 | |
1170 | }, |
|
1166 | }, | |
1171 | { |
|
1167 | { | |
1172 | "cell_type": "markdown", |
|
1168 | "cell_type": "markdown", | |
@@ -1189,7 +1185,7 b'' | |||||
1189 | "language": "python", |
|
1185 | "language": "python", | |
1190 | "metadata": {}, |
|
1186 | "metadata": {}, | |
1191 | "outputs": [], |
|
1187 | "outputs": [], | |
1192 |
"prompt_number": |
|
1188 | "prompt_number": 57 | |
1193 | }, |
|
1189 | }, | |
1194 | { |
|
1190 | { | |
1195 | "cell_type": "code", |
|
1191 | "cell_type": "code", | |
@@ -1201,7 +1197,7 b'' | |||||
1201 | "language": "python", |
|
1197 | "language": "python", | |
1202 | "metadata": {}, |
|
1198 | "metadata": {}, | |
1203 | "outputs": [], |
|
1199 | "outputs": [], | |
1204 |
"prompt_number": |
|
1200 | "prompt_number": 46 | |
1205 | }, |
|
1201 | }, | |
1206 | { |
|
1202 | { | |
1207 | "cell_type": "code", |
|
1203 | "cell_type": "code", | |
@@ -1213,7 +1209,35 b'' | |||||
1213 | "language": "python", |
|
1209 | "language": "python", | |
1214 | "metadata": {}, |
|
1210 | "metadata": {}, | |
1215 | "outputs": [], |
|
1211 | "outputs": [], | |
1216 |
"prompt_number": |
|
1212 | "prompt_number": 48 | |
|
1213 | }, | |||
|
1214 | { | |||
|
1215 | "cell_type": "code", | |||
|
1216 | "collapsed": false, | |||
|
1217 | "input": [ | |||
|
1218 | "my_widget.value" | |||
|
1219 | ], | |||
|
1220 | "language": "python", | |||
|
1221 | "metadata": {}, | |||
|
1222 | "outputs": [ | |||
|
1223 | { | |||
|
1224 | "metadata": {}, | |||
|
1225 | "output_type": "pyout", | |||
|
1226 | "prompt_number": 58, | |||
|
1227 | "text": [ | |||
|
1228 | "u''" | |||
|
1229 | ] | |||
|
1230 | } | |||
|
1231 | ], | |||
|
1232 | "prompt_number": 58 | |||
|
1233 | }, | |||
|
1234 | { | |||
|
1235 | "cell_type": "code", | |||
|
1236 | "collapsed": false, | |||
|
1237 | "input": [], | |||
|
1238 | "language": "python", | |||
|
1239 | "metadata": {}, | |||
|
1240 | "outputs": [] | |||
1217 | } |
|
1241 | } | |
1218 | ], |
|
1242 | ], | |
1219 | "metadata": {} |
|
1243 | "metadata": {} |
General Comments 0
You need to be logged in to leave comments.
Login now