Show More
@@ -1,5 +1,11 | |||||
1 | { |
|
1 | { | |
2 | "metadata": { |
|
2 | "metadata": { | |
|
3 | "cell_tags": [ | |||
|
4 | [ | |||
|
5 | "<None>", | |||
|
6 | null | |||
|
7 | ] | |||
|
8 | ], | |||
3 | "name": "" |
|
9 | "name": "" | |
4 | }, |
|
10 | }, | |
5 | "nbformat": 3, |
|
11 | "nbformat": 3, | |
@@ -22,70 +28,70 | |||||
22 | "outputs": [ |
|
28 | "outputs": [ | |
23 | { |
|
29 | { | |
24 | "javascript": [ |
|
30 | "javascript": [ | |
25 |
"$.getScript( |
|
31 | "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/button.js\");" | |
26 | ], |
|
32 | ], | |
27 | "metadata": {}, |
|
33 | "metadata": {}, | |
28 | "output_type": "display_data" |
|
34 | "output_type": "display_data" | |
29 | }, |
|
35 | }, | |
30 | { |
|
36 | { | |
31 | "javascript": [ |
|
37 | "javascript": [ | |
32 |
"$.getScript( |
|
38 | "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/int_range.js\");" | |
33 | ], |
|
39 | ], | |
34 | "metadata": {}, |
|
40 | "metadata": {}, | |
35 | "output_type": "display_data" |
|
41 | "output_type": "display_data" | |
36 | }, |
|
42 | }, | |
37 | { |
|
43 | { | |
38 | "javascript": [ |
|
44 | "javascript": [ | |
39 |
"$.getScript( |
|
45 | "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/string.js\");" | |
40 | ], |
|
46 | ], | |
41 | "metadata": {}, |
|
47 | "metadata": {}, | |
42 | "output_type": "display_data" |
|
48 | "output_type": "display_data" | |
43 | }, |
|
49 | }, | |
44 | { |
|
50 | { | |
45 | "javascript": [ |
|
51 | "javascript": [ | |
46 |
"$.getScript( |
|
52 | "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/multicontainer.js\");" | |
47 | ], |
|
53 | ], | |
48 | "metadata": {}, |
|
54 | "metadata": {}, | |
49 | "output_type": "display_data" |
|
55 | "output_type": "display_data" | |
50 | }, |
|
56 | }, | |
51 | { |
|
57 | { | |
52 | "javascript": [ |
|
58 | "javascript": [ | |
53 |
"$.getScript( |
|
59 | "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/bool.js\");" | |
54 | ], |
|
60 | ], | |
55 | "metadata": {}, |
|
61 | "metadata": {}, | |
56 | "output_type": "display_data" |
|
62 | "output_type": "display_data" | |
57 | }, |
|
63 | }, | |
58 | { |
|
64 | { | |
59 | "javascript": [ |
|
65 | "javascript": [ | |
60 |
"$.getScript( |
|
66 | "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/int.js\");" | |
61 | ], |
|
67 | ], | |
62 | "metadata": {}, |
|
68 | "metadata": {}, | |
63 | "output_type": "display_data" |
|
69 | "output_type": "display_data" | |
64 | }, |
|
70 | }, | |
65 | { |
|
71 | { | |
66 | "javascript": [ |
|
72 | "javascript": [ | |
67 |
"$.getScript( |
|
73 | "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/selection.js\");" | |
68 | ], |
|
74 | ], | |
69 | "metadata": {}, |
|
75 | "metadata": {}, | |
70 | "output_type": "display_data" |
|
76 | "output_type": "display_data" | |
71 | }, |
|
77 | }, | |
72 | { |
|
78 | { | |
73 | "javascript": [ |
|
79 | "javascript": [ | |
74 |
"$.getScript( |
|
80 | "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/float.js\");" | |
75 | ], |
|
81 | ], | |
76 | "metadata": {}, |
|
82 | "metadata": {}, | |
77 | "output_type": "display_data" |
|
83 | "output_type": "display_data" | |
78 | }, |
|
84 | }, | |
79 | { |
|
85 | { | |
80 | "javascript": [ |
|
86 | "javascript": [ | |
81 |
"$.getScript( |
|
87 | "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/float_range.js\");" | |
82 | ], |
|
88 | ], | |
83 | "metadata": {}, |
|
89 | "metadata": {}, | |
84 | "output_type": "display_data" |
|
90 | "output_type": "display_data" | |
85 | }, |
|
91 | }, | |
86 | { |
|
92 | { | |
87 | "javascript": [ |
|
93 | "javascript": [ | |
88 |
"$.getScript( |
|
94 | "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/container.js\");" | |
89 | ], |
|
95 | ], | |
90 | "metadata": {}, |
|
96 | "metadata": {}, | |
91 | "output_type": "display_data" |
|
97 | "output_type": "display_data" | |
@@ -221,26 +227,26 | |||||
221 | "cell_type": "markdown", |
|
227 | "cell_type": "markdown", | |
222 | "metadata": {}, |
|
228 | "metadata": {}, | |
223 | "source": [ |
|
229 | "source": [ | |
224 |
"The `ContainerWidget` |
|
230 | "The `ContainerWidget` `pack_start`, `pack_center`, and `pack_end` methods (parameterless) adjust the alignment of the widgets on the axis that they are being rendered on. Below is an example of the different alignments." | |
225 | ] |
|
231 | ] | |
226 | }, |
|
232 | }, | |
227 | { |
|
233 | { | |
228 | "cell_type": "code", |
|
234 | "cell_type": "code", | |
229 | "collapsed": false, |
|
235 | "collapsed": false, | |
230 | "input": [ |
|
236 | "input": [ | |
231 | "container = make_container('HBox Start')\n", |
|
237 | "container = make_container('HBox Pack Start')\n", | |
232 | "container.hbox()\n", |
|
238 | "container.hbox()\n", | |
233 | "container.start()\n", |
|
239 | "container.pack_start()\n", | |
234 | "fill_container(container)\n", |
|
240 | "fill_container(container)\n", | |
235 | " \n", |
|
241 | " \n", | |
236 | "container = make_container('HBox Center')\n", |
|
242 | "container = make_container('HBox Pack Center')\n", | |
237 | "container.hbox()\n", |
|
243 | "container.hbox()\n", | |
238 | "container.center()\n", |
|
244 | "container.pack_center()\n", | |
239 | "fill_container(container)\n", |
|
245 | "fill_container(container)\n", | |
240 | " \n", |
|
246 | " \n", | |
241 | "container = make_container('HBox End')\n", |
|
247 | "container = make_container('HBox Pack End')\n", | |
242 | "container.hbox()\n", |
|
248 | "container.hbox()\n", | |
243 | "container.end()\n", |
|
249 | "container.pack_end()\n", | |
244 | "fill_container(container)" |
|
250 | "fill_container(container)" | |
245 | ], |
|
251 | ], | |
246 | "language": "python", |
|
252 | "language": "python", | |
@@ -252,6 +258,45 | |||||
252 | "cell_type": "markdown", |
|
258 | "cell_type": "markdown", | |
253 | "metadata": {}, |
|
259 | "metadata": {}, | |
254 | "source": [ |
|
260 | "source": [ | |
|
261 | "The `ContainerWidget` `align_start`, `align_center`, and `align_end` methods (parameterless) adjust the alignment of the widgets on the axis perpindicular to the one that they are being rendered on. Below is an example of the different alignments." | |||
|
262 | ] | |||
|
263 | }, | |||
|
264 | { | |||
|
265 | "cell_type": "code", | |||
|
266 | "collapsed": false, | |||
|
267 | "input": [ | |||
|
268 | "def fill_container(container):\n", | |||
|
269 | " components = []\n", | |||
|
270 | " for i in range(3):\n", | |||
|
271 | " components.append(widgets.StringWidget(parent=container, default_view_name='LabelView', value=\"ABC\"[i]))\n", | |||
|
272 | " components[i].set_css(child_style)\n", | |||
|
273 | " components[i].set_css('height', str((i+1) * 50) + 'px')\n", | |||
|
274 | " display(components[i])\n", | |||
|
275 | "\n", | |||
|
276 | "container = make_container('HBox Align Start')\n", | |||
|
277 | "container.hbox()\n", | |||
|
278 | "container.align_start()\n", | |||
|
279 | "fill_container(container)\n", | |||
|
280 | " \n", | |||
|
281 | "container = make_container('HBox Align Center')\n", | |||
|
282 | "container.hbox()\n", | |||
|
283 | "container.align_center()\n", | |||
|
284 | "fill_container(container)\n", | |||
|
285 | " \n", | |||
|
286 | "container = make_container('HBox Align End')\n", | |||
|
287 | "container.hbox()\n", | |||
|
288 | "container.align_end()\n", | |||
|
289 | "fill_container(container)" | |||
|
290 | ], | |||
|
291 | "language": "python", | |||
|
292 | "metadata": {}, | |||
|
293 | "outputs": [], | |||
|
294 | "prompt_number": 7 | |||
|
295 | }, | |||
|
296 | { | |||
|
297 | "cell_type": "markdown", | |||
|
298 | "metadata": {}, | |||
|
299 | "source": [ | |||
255 | "By default the widget area is a `vbox`; however, there are many uses for a `hbox`. The example below uses a `hbox` to display a set of vertical sliders, like an equalizer." |
|
300 | "By default the widget area is a `vbox`; however, there are many uses for a `hbox`. The example below uses a `hbox` to display a set of vertical sliders, like an equalizer." | |
256 | ] |
|
301 | ] | |
257 | }, |
|
302 | }, | |
@@ -268,7 +313,7 | |||||
268 | "language": "python", |
|
313 | "language": "python", | |
269 | "metadata": {}, |
|
314 | "metadata": {}, | |
270 | "outputs": [], |
|
315 | "outputs": [], | |
271 |
"prompt_number": |
|
316 | "prompt_number": 8 | |
272 | } |
|
317 | } | |
273 | ], |
|
318 | ], | |
274 | "metadata": {} |
|
319 | "metadata": {} |
General Comments 0
You need to be logged in to leave comments.
Login now