Show More
@@ -1,580 +1,586 b'' | |||||
1 | { |
|
1 | { | |
2 | "cells": [ |
|
2 | "cells": [ | |
3 | { |
|
3 | { | |
4 | "cell_type": "markdown", |
|
4 | "cell_type": "markdown", | |
5 | "metadata": {}, |
|
5 | "metadata": {}, | |
6 | "source": [ |
|
6 | "source": [ | |
7 | "[Index](Index.ipynb) - [Back](Widget Basics.ipynb) - [Next](Widget Events.ipynb)" |
|
7 | "[Index](Index.ipynb) - [Back](Widget Basics.ipynb) - [Next](Widget Events.ipynb)" | |
8 | ] |
|
8 | ] | |
9 | }, |
|
9 | }, | |
10 | { |
|
10 | { | |
11 | "cell_type": "markdown", |
|
11 | "cell_type": "markdown", | |
12 | "metadata": {}, |
|
12 | "metadata": {}, | |
13 | "source": [ |
|
13 | "source": [ | |
14 | "# Widget List" |
|
14 | "# Widget List" | |
15 | ] |
|
15 | ] | |
16 | }, |
|
16 | }, | |
17 | { |
|
17 | { | |
18 | "cell_type": "markdown", |
|
18 | "cell_type": "markdown", | |
19 | "metadata": {}, |
|
19 | "metadata": {}, | |
20 | "source": [ |
|
20 | "source": [ | |
21 | "## Complete list" |
|
21 | "## Complete list" | |
22 | ] |
|
22 | ] | |
23 | }, |
|
23 | }, | |
24 | { |
|
24 | { | |
25 | "cell_type": "markdown", |
|
25 | "cell_type": "markdown", | |
26 | "metadata": { |
|
26 | "metadata": { | |
27 | "slideshow": { |
|
27 | "slideshow": { | |
28 | "slide_type": "slide" |
|
28 | "slide_type": "slide" | |
29 | } |
|
29 | } | |
30 | }, |
|
30 | }, | |
31 | "source": [ |
|
31 | "source": [ | |
32 | "For a complete list of the widgets available to you, you can list the classes in the widget namespace (as seen below). `Widget` and `DOMWidget`, not listed below, are base classes." |
|
32 | "For a complete list of the widgets available to you, you can list the classes in the widget namespace (as seen below). `Widget` and `DOMWidget`, not listed below, are base classes." | |
33 | ] |
|
33 | ] | |
34 | }, |
|
34 | }, | |
35 | { |
|
35 | { | |
36 | "cell_type": "code", |
|
36 | "cell_type": "code", | |
37 | "execution_count": null, |
|
37 | "execution_count": null, | |
38 | "metadata": { |
|
38 | "metadata": { | |
39 | "collapsed": false |
|
39 | "collapsed": false | |
40 | }, |
|
40 | }, | |
41 | "outputs": [], |
|
41 | "outputs": [], | |
42 | "source": [ |
|
42 | "source": [ | |
43 | "from IPython.html import widgets\n", |
|
43 | "from IPython.html import widgets\n", | |
44 | "[n for n in dir(widgets) if not n.endswith('Widget') and n[0] == n[0].upper() and not n[0] == '_']" |
|
44 | "[n for n in dir(widgets) if not n.endswith('Widget') and n[0] == n[0].upper() and not n[0] == '_']" | |
45 | ] |
|
45 | ] | |
46 | }, |
|
46 | }, | |
47 | { |
|
47 | { | |
48 | "cell_type": "markdown", |
|
48 | "cell_type": "markdown", | |
49 | "metadata": { |
|
49 | "metadata": { | |
50 | "slideshow": { |
|
50 | "slideshow": { | |
51 | "slide_type": "slide" |
|
51 | "slide_type": "slide" | |
52 | } |
|
52 | } | |
53 | }, |
|
53 | }, | |
54 | "source": [ |
|
54 | "source": [ | |
55 | "## Numeric widgets" |
|
55 | "## Numeric widgets" | |
56 | ] |
|
56 | ] | |
57 | }, |
|
57 | }, | |
58 | { |
|
58 | { | |
59 | "cell_type": "markdown", |
|
59 | "cell_type": "markdown", | |
60 | "metadata": {}, |
|
60 | "metadata": {}, | |
61 | "source": [ |
|
61 | "source": [ | |
62 | "There are 8 widgets distributed with IPython that are designed to display numeric values. Widgets exist for displaying integers and floats, both bounded and unbounded. The integer widgets share a similar naming scheme to their floating point counterparts. By replacing `Float` with `Int` in the widget name, you can find the Integer equivalent." |
|
62 | "There are 8 widgets distributed with IPython that are designed to display numeric values. Widgets exist for displaying integers and floats, both bounded and unbounded. The integer widgets share a similar naming scheme to their floating point counterparts. By replacing `Float` with `Int` in the widget name, you can find the Integer equivalent." | |
63 | ] |
|
63 | ] | |
64 | }, |
|
64 | }, | |
65 | { |
|
65 | { | |
66 | "cell_type": "markdown", |
|
66 | "cell_type": "markdown", | |
67 | "metadata": { |
|
67 | "metadata": { | |
68 | "slideshow": { |
|
68 | "slideshow": { | |
69 | "slide_type": "slide" |
|
69 | "slide_type": "slide" | |
70 | } |
|
70 | } | |
71 | }, |
|
71 | }, | |
72 | "source": [ |
|
72 | "source": [ | |
73 | "### FloatSlider" |
|
73 | "### FloatSlider" | |
74 | ] |
|
74 | ] | |
75 | }, |
|
75 | }, | |
76 | { |
|
76 | { | |
77 | "cell_type": "code", |
|
77 | "cell_type": "code", | |
78 | "execution_count": null, |
|
78 | "execution_count": null, | |
79 | "metadata": { |
|
79 | "metadata": { | |
80 | "collapsed": false |
|
80 | "collapsed": false | |
81 | }, |
|
81 | }, | |
82 | "outputs": [], |
|
82 | "outputs": [], | |
83 | "source": [ |
|
83 | "source": [ | |
84 | "widgets.FloatSlider(\n", |
|
84 | "widgets.FloatSlider(\n", | |
85 | " value=7.5,\n", |
|
85 | " value=7.5,\n", | |
86 | " min=5.0,\n", |
|
86 | " min=5.0,\n", | |
87 | " max=10.0,\n", |
|
87 | " max=10.0,\n", | |
88 | " step=0.1,\n", |
|
88 | " step=0.1,\n", | |
89 | " description='Test:',\n", |
|
89 | " description='Test:',\n", | |
90 | ")" |
|
90 | ")" | |
91 | ] |
|
91 | ] | |
92 | }, |
|
92 | }, | |
93 | { |
|
93 | { | |
94 | "cell_type": "markdown", |
|
94 | "cell_type": "markdown", | |
95 | "metadata": {}, |
|
95 | "metadata": {}, | |
96 | "source": [ |
|
96 | "source": [ | |
97 | "Sliders can also be **displayed vertically**." |
|
97 | "Sliders can also be **displayed vertically**." | |
98 | ] |
|
98 | ] | |
99 | }, |
|
99 | }, | |
100 | { |
|
100 | { | |
101 | "cell_type": "code", |
|
101 | "cell_type": "code", | |
102 | "execution_count": null, |
|
102 | "execution_count": null, | |
103 | "metadata": { |
|
103 | "metadata": { | |
104 | "collapsed": false |
|
104 | "collapsed": false | |
105 | }, |
|
105 | }, | |
106 | "outputs": [], |
|
106 | "outputs": [], | |
107 | "source": [ |
|
107 | "source": [ | |
108 | "widgets.FloatSlider(\n", |
|
108 | "widgets.FloatSlider(\n", | |
109 | " value=7.5,\n", |
|
109 | " value=7.5,\n", | |
110 | " min=5.0,\n", |
|
110 | " min=5.0,\n", | |
111 | " max=10.0,\n", |
|
111 | " max=10.0,\n", | |
112 | " step=0.1,\n", |
|
112 | " step=0.1,\n", | |
113 | " description='Test',\n", |
|
113 | " description='Test',\n", | |
114 | " orientation='vertical',\n", |
|
114 | " orientation='vertical',\n", | |
115 | ")" |
|
115 | ")" | |
116 | ] |
|
116 | ] | |
117 | }, |
|
117 | }, | |
118 | { |
|
118 | { | |
119 | "cell_type": "markdown", |
|
119 | "cell_type": "markdown", | |
120 | "metadata": { |
|
120 | "metadata": { | |
121 | "slideshow": { |
|
121 | "slideshow": { | |
122 | "slide_type": "slide" |
|
122 | "slide_type": "slide" | |
123 | } |
|
123 | } | |
124 | }, |
|
124 | }, | |
125 | "source": [ |
|
125 | "source": [ | |
126 | "### FloatProgress" |
|
126 | "### FloatProgress" | |
127 | ] |
|
127 | ] | |
128 | }, |
|
128 | }, | |
129 | { |
|
129 | { | |
130 | "cell_type": "code", |
|
130 | "cell_type": "code", | |
131 | "execution_count": null, |
|
131 | "execution_count": null, | |
132 | "metadata": { |
|
132 | "metadata": { | |
133 | "collapsed": false |
|
133 | "collapsed": false | |
134 | }, |
|
134 | }, | |
135 | "outputs": [], |
|
135 | "outputs": [], | |
136 | "source": [ |
|
136 | "source": [ | |
137 | "widgets.FloatProgress(\n", |
|
137 | "widgets.FloatProgress(\n", | |
138 | " value=7.5,\n", |
|
138 | " value=7.5,\n", | |
139 | " min=5.0,\n", |
|
139 | " min=5.0,\n", | |
140 | " max=10.0,\n", |
|
140 | " max=10.0,\n", | |
141 | " step=0.1,\n", |
|
141 | " step=0.1,\n", | |
142 | " description='Loading:',\n", |
|
142 | " description='Loading:',\n", | |
143 | ")" |
|
143 | ")" | |
144 | ] |
|
144 | ] | |
145 | }, |
|
145 | }, | |
146 | { |
|
146 | { | |
147 | "cell_type": "markdown", |
|
147 | "cell_type": "markdown", | |
148 | "metadata": { |
|
148 | "metadata": { | |
149 | "slideshow": { |
|
149 | "slideshow": { | |
150 | "slide_type": "slide" |
|
150 | "slide_type": "slide" | |
151 | } |
|
151 | } | |
152 | }, |
|
152 | }, | |
153 | "source": [ |
|
153 | "source": [ | |
154 | "### BoundedFloatText" |
|
154 | "### BoundedFloatText" | |
155 | ] |
|
155 | ] | |
156 | }, |
|
156 | }, | |
157 | { |
|
157 | { | |
158 | "cell_type": "code", |
|
158 | "cell_type": "code", | |
159 | "execution_count": null, |
|
159 | "execution_count": null, | |
160 | "metadata": { |
|
160 | "metadata": { | |
161 | "collapsed": false |
|
161 | "collapsed": false | |
162 | }, |
|
162 | }, | |
163 | "outputs": [], |
|
163 | "outputs": [], | |
164 | "source": [ |
|
164 | "source": [ | |
165 | "widgets.BoundedFloatText(\n", |
|
165 | "widgets.BoundedFloatText(\n", | |
166 | " value=7.5,\n", |
|
166 | " value=7.5,\n", | |
167 | " min=5.0,\n", |
|
167 | " min=5.0,\n", | |
168 | " max=10.0,\n", |
|
168 | " max=10.0,\n", | |
169 | " description='Text:',\n", |
|
169 | " description='Text:',\n", | |
170 | ")" |
|
170 | ")" | |
171 | ] |
|
171 | ] | |
172 | }, |
|
172 | }, | |
173 | { |
|
173 | { | |
174 | "cell_type": "markdown", |
|
174 | "cell_type": "markdown", | |
175 | "metadata": { |
|
175 | "metadata": { | |
176 | "slideshow": { |
|
176 | "slideshow": { | |
177 | "slide_type": "slide" |
|
177 | "slide_type": "slide" | |
178 | } |
|
178 | } | |
179 | }, |
|
179 | }, | |
180 | "source": [ |
|
180 | "source": [ | |
181 | "### FloatText" |
|
181 | "### FloatText" | |
182 | ] |
|
182 | ] | |
183 | }, |
|
183 | }, | |
184 | { |
|
184 | { | |
185 | "cell_type": "code", |
|
185 | "cell_type": "code", | |
186 | "execution_count": null, |
|
186 | "execution_count": null, | |
187 | "metadata": { |
|
187 | "metadata": { | |
188 | "collapsed": false |
|
188 | "collapsed": false | |
189 | }, |
|
189 | }, | |
190 | "outputs": [], |
|
190 | "outputs": [], | |
191 | "source": [ |
|
191 | "source": [ | |
192 | "widgets.FloatText(\n", |
|
192 | "widgets.FloatText(\n", | |
193 | " value=7.5,\n", |
|
193 | " value=7.5,\n", | |
194 | " description='Any:',\n", |
|
194 | " description='Any:',\n", | |
195 | ")" |
|
195 | ")" | |
196 | ] |
|
196 | ] | |
197 | }, |
|
197 | }, | |
198 | { |
|
198 | { | |
199 | "cell_type": "markdown", |
|
199 | "cell_type": "markdown", | |
200 | "metadata": { |
|
200 | "metadata": { | |
201 | "slideshow": { |
|
201 | "slideshow": { | |
202 | "slide_type": "slide" |
|
202 | "slide_type": "slide" | |
203 | } |
|
203 | } | |
204 | }, |
|
204 | }, | |
205 | "source": [ |
|
205 | "source": [ | |
206 | "## Boolean widgets" |
|
206 | "## Boolean widgets" | |
207 | ] |
|
207 | ] | |
208 | }, |
|
208 | }, | |
209 | { |
|
209 | { | |
210 | "cell_type": "markdown", |
|
210 | "cell_type": "markdown", | |
211 | "metadata": {}, |
|
211 | "metadata": {}, | |
212 | "source": [ |
|
212 | "source": [ | |
213 | "There are two widgets that are designed to display a boolean value." |
|
213 | "There are two widgets that are designed to display a boolean value." | |
214 | ] |
|
214 | ] | |
215 | }, |
|
215 | }, | |
216 | { |
|
216 | { | |
217 | "cell_type": "markdown", |
|
217 | "cell_type": "markdown", | |
218 | "metadata": {}, |
|
218 | "metadata": {}, | |
219 | "source": [ |
|
219 | "source": [ | |
220 | "### ToggleButton" |
|
220 | "### ToggleButton" | |
221 | ] |
|
221 | ] | |
222 | }, |
|
222 | }, | |
223 | { |
|
223 | { | |
224 | "cell_type": "code", |
|
224 | "cell_type": "code", | |
225 | "execution_count": null, |
|
225 | "execution_count": null, | |
226 | "metadata": { |
|
226 | "metadata": { | |
227 | "collapsed": false |
|
227 | "collapsed": false | |
228 | }, |
|
228 | }, | |
229 | "outputs": [], |
|
229 | "outputs": [], | |
230 | "source": [ |
|
230 | "source": [ | |
231 | "widgets.ToggleButton(\n", |
|
231 | "widgets.ToggleButton(\n", | |
232 | " description='Click me',\n", |
|
232 | " description='Click me',\n", | |
233 | " value=False,\n", |
|
233 | " value=False,\n", | |
234 | ")" |
|
234 | ")" | |
235 | ] |
|
235 | ] | |
236 | }, |
|
236 | }, | |
237 | { |
|
237 | { | |
238 | "cell_type": "markdown", |
|
238 | "cell_type": "markdown", | |
239 | "metadata": { |
|
239 | "metadata": { | |
240 | "slideshow": { |
|
240 | "slideshow": { | |
241 | "slide_type": "slide" |
|
241 | "slide_type": "slide" | |
242 | } |
|
242 | } | |
243 | }, |
|
243 | }, | |
244 | "source": [ |
|
244 | "source": [ | |
245 | "### Checkbox" |
|
245 | "### Checkbox" | |
246 | ] |
|
246 | ] | |
247 | }, |
|
247 | }, | |
248 | { |
|
248 | { | |
249 | "cell_type": "code", |
|
249 | "cell_type": "code", | |
250 | "execution_count": null, |
|
250 | "execution_count": null, | |
251 | "metadata": { |
|
251 | "metadata": { | |
252 | "collapsed": false |
|
252 | "collapsed": false | |
253 | }, |
|
253 | }, | |
254 | "outputs": [], |
|
254 | "outputs": [], | |
255 | "source": [ |
|
255 | "source": [ | |
256 | "widgets.Checkbox(\n", |
|
256 | "widgets.Checkbox(\n", | |
257 | " description='Check me',\n", |
|
257 | " description='Check me',\n", | |
258 | " value=True,\n", |
|
258 | " value=True,\n", | |
259 | ")" |
|
259 | ")" | |
260 | ] |
|
260 | ] | |
261 | }, |
|
261 | }, | |
262 | { |
|
262 | { | |
263 | "cell_type": "markdown", |
|
263 | "cell_type": "markdown", | |
264 | "metadata": { |
|
264 | "metadata": { | |
265 | "slideshow": { |
|
265 | "slideshow": { | |
266 | "slide_type": "slide" |
|
266 | "slide_type": "slide" | |
267 | } |
|
267 | } | |
268 | }, |
|
268 | }, | |
269 | "source": [ |
|
269 | "source": [ | |
270 | "## Selection widgets" |
|
270 | "## Selection widgets" | |
271 | ] |
|
271 | ] | |
272 | }, |
|
272 | }, | |
273 | { |
|
273 | { | |
274 | "cell_type": "markdown", |
|
274 | "cell_type": "markdown", | |
275 | "metadata": {}, |
|
275 | "metadata": {}, | |
276 | "source": [ |
|
276 | "source": [ | |
277 | "There are four widgets that can be used to display single selection lists. All four inherit from the same base class. You can specify the **enumeration of selectables by passing a list**. You can **also specify the enumeration as a dictionary**, in which case the **keys will be used as the item displayed** in the list and the corresponding **value will be returned** when an item is selected." |
|
277 | "There are four widgets that can be used to display single selection lists. All four inherit from the same base class. You can specify the **enumeration of selectables by passing a list**. You can **also specify the enumeration as a dictionary**, in which case the **keys will be used as the item displayed** in the list and the corresponding **value will be returned** when an item is selected." | |
278 | ] |
|
278 | ] | |
279 | }, |
|
279 | }, | |
280 | { |
|
280 | { | |
281 | "cell_type": "markdown", |
|
281 | "cell_type": "markdown", | |
282 | "metadata": { |
|
282 | "metadata": { | |
283 | "slideshow": { |
|
283 | "slideshow": { | |
284 | "slide_type": "slide" |
|
284 | "slide_type": "slide" | |
285 | } |
|
285 | } | |
286 | }, |
|
286 | }, | |
287 | "source": [ |
|
287 | "source": [ | |
288 | "### Dropdown" |
|
288 | "### Dropdown" | |
289 | ] |
|
289 | ] | |
290 | }, |
|
290 | }, | |
291 | { |
|
291 | { | |
292 | "cell_type": "code", |
|
292 | "cell_type": "code", | |
293 | "execution_count": null, |
|
293 | "execution_count": null, | |
294 | "metadata": { |
|
294 | "metadata": { | |
295 | "collapsed": false |
|
295 | "collapsed": false | |
296 | }, |
|
296 | }, | |
297 | "outputs": [], |
|
297 | "outputs": [], | |
298 | "source": [ |
|
298 | "source": [ | |
299 | "from IPython.display import display\n", |
|
299 | "from IPython.display import display\n", | |
300 | "w = widgets.Dropdown(\n", |
|
300 | "w = widgets.Dropdown(\n", | |
301 | " values=[1, 2, 3],\n", |
|
301 | " values=['1', '2', '3'],\n", | |
302 | " value=2,\n", |
|
302 | " value='2',\n", | |
303 | " description='Number:',\n", |
|
303 | " description='Number:',\n", | |
304 | ")\n", |
|
304 | ")\n", | |
305 | "display(w)" |
|
305 | "display(w)" | |
306 | ] |
|
306 | ] | |
307 | }, |
|
307 | }, | |
308 | { |
|
308 | { | |
309 | "cell_type": "code", |
|
309 | "cell_type": "code", | |
310 | "execution_count": null, |
|
310 | "execution_count": null, | |
311 | "metadata": { |
|
311 | "metadata": { | |
312 | "collapsed": false |
|
312 | "collapsed": false | |
313 | }, |
|
313 | }, | |
314 | "outputs": [], |
|
314 | "outputs": [], | |
315 | "source": [ |
|
315 | "source": [ | |
316 | "w.value" |
|
316 | "w.value" | |
317 | ] |
|
317 | ] | |
318 | }, |
|
318 | }, | |
319 | { |
|
319 | { | |
320 | "cell_type": "markdown", |
|
320 | "cell_type": "markdown", | |
321 | "metadata": {}, |
|
321 | "metadata": {}, | |
322 | "source": [ |
|
322 | "source": [ | |
323 | "The following is also valid:" |
|
323 | "The following is also valid:" | |
324 | ] |
|
324 | ] | |
325 | }, |
|
325 | }, | |
326 | { |
|
326 | { | |
327 | "cell_type": "code", |
|
327 | "cell_type": "code", | |
328 | "execution_count": null, |
|
328 | "execution_count": null, | |
329 | "metadata": { |
|
329 | "metadata": { | |
330 | "collapsed": false |
|
330 | "collapsed": false | |
331 | }, |
|
331 | }, | |
332 | "outputs": [], |
|
332 | "outputs": [], | |
333 | "source": [ |
|
333 | "source": [ | |
334 | "w = widgets.Dropdown(\n", |
|
334 | "w = widgets.Dropdown(\n", | |
335 | " values={'One': 1, 'Two': 2, 'Three': 3},\n", |
|
335 | " values={'One': 1, 'Two': 2, 'Three': 3},\n", | |
336 | " value=2,\n", |
|
336 | " value=2,\n", | |
337 | " description='Number:',\n", |
|
337 | " description='Number:',\n", | |
338 | ")\n", |
|
338 | ")\n", | |
339 | "display(w)" |
|
339 | "display(w)" | |
340 | ] |
|
340 | ] | |
341 | }, |
|
341 | }, | |
342 | { |
|
342 | { | |
343 | "cell_type": "code", |
|
343 | "cell_type": "code", | |
344 | "execution_count": null, |
|
344 | "execution_count": null, | |
345 | "metadata": { |
|
345 | "metadata": { | |
346 | "collapsed": false |
|
346 | "collapsed": false | |
347 | }, |
|
347 | }, | |
348 | "outputs": [], |
|
348 | "outputs": [], | |
349 | "source": [ |
|
349 | "source": [ | |
350 | "w.value" |
|
350 | "w.value" | |
351 | ] |
|
351 | ] | |
352 | }, |
|
352 | }, | |
353 | { |
|
353 | { | |
354 | "cell_type": "markdown", |
|
354 | "cell_type": "markdown", | |
355 | "metadata": { |
|
355 | "metadata": { | |
356 | "slideshow": { |
|
356 | "slideshow": { | |
357 | "slide_type": "slide" |
|
357 | "slide_type": "slide" | |
358 | } |
|
358 | } | |
359 | }, |
|
359 | }, | |
360 | "source": [ |
|
360 | "source": [ | |
361 | "### RadioButtons" |
|
361 | "### RadioButtons" | |
362 | ] |
|
362 | ] | |
363 | }, |
|
363 | }, | |
364 | { |
|
364 | { | |
365 | "cell_type": "code", |
|
365 | "cell_type": "code", | |
366 | "execution_count": null, |
|
366 | "execution_count": null, | |
367 | "metadata": { |
|
367 | "metadata": { | |
368 | "collapsed": false |
|
368 | "collapsed": false | |
369 | }, |
|
369 | }, | |
370 | "outputs": [], |
|
370 | "outputs": [], | |
371 | "source": [ |
|
371 | "source": [ | |
372 | "widgets.RadioButtons(\n", |
|
372 | "widgets.RadioButtons(\n", | |
373 | " description='Pizza topping:',\n", |
|
373 | " description='Pizza topping:',\n", | |
374 | " values=['pepperoni', 'pineapple', 'anchovies'],\n", |
|
374 | " values=['pepperoni', 'pineapple', 'anchovies'],\n", | |
375 | ")" |
|
375 | ")" | |
376 | ] |
|
376 | ] | |
377 | }, |
|
377 | }, | |
378 | { |
|
378 | { | |
379 | "cell_type": "markdown", |
|
379 | "cell_type": "markdown", | |
380 | "metadata": { |
|
380 | "metadata": { | |
381 | "slideshow": { |
|
381 | "slideshow": { | |
382 | "slide_type": "slide" |
|
382 | "slide_type": "slide" | |
383 | } |
|
383 | } | |
384 | }, |
|
384 | }, | |
385 | "source": [ |
|
385 | "source": [ | |
386 | "### Select" |
|
386 | "### Select" | |
387 | ] |
|
387 | ] | |
388 | }, |
|
388 | }, | |
389 | { |
|
389 | { | |
390 | "cell_type": "code", |
|
390 | "cell_type": "code", | |
391 | "execution_count": null, |
|
391 | "execution_count": null, | |
392 | "metadata": { |
|
392 | "metadata": { | |
393 | "collapsed": false |
|
393 | "collapsed": false | |
394 | }, |
|
394 | }, | |
395 | "outputs": [], |
|
395 | "outputs": [], | |
396 | "source": [ |
|
396 | "source": [ | |
397 | "widgets.Select(\n", |
|
397 | "widgets.Select(\n", | |
398 | " description='OS:',\n", |
|
398 | " description='OS:',\n", | |
399 | " values=['Linux', 'Windows', 'OSX'],\n", |
|
399 | " values=['Linux', 'Windows', 'OSX'],\n", | |
400 | ")" |
|
400 | ")" | |
401 | ] |
|
401 | ] | |
402 | }, |
|
402 | }, | |
403 | { |
|
403 | { | |
404 | "cell_type": "markdown", |
|
404 | "cell_type": "markdown", | |
405 | "metadata": { |
|
405 | "metadata": { | |
406 | "slideshow": { |
|
406 | "slideshow": { | |
407 | "slide_type": "slide" |
|
407 | "slide_type": "slide" | |
408 | } |
|
408 | } | |
409 | }, |
|
409 | }, | |
410 | "source": [ |
|
410 | "source": [ | |
411 | "### ToggleButtons" |
|
411 | "### ToggleButtons" | |
412 | ] |
|
412 | ] | |
413 | }, |
|
413 | }, | |
414 | { |
|
414 | { | |
415 | "cell_type": "code", |
|
415 | "cell_type": "code", | |
416 | "execution_count": null, |
|
416 | "execution_count": null, | |
417 | "metadata": { |
|
417 | "metadata": { | |
418 | "collapsed": false |
|
418 | "collapsed": false | |
419 | }, |
|
419 | }, | |
420 | "outputs": [], |
|
420 | "outputs": [], | |
421 | "source": [ |
|
421 | "source": [ | |
422 | "widgets.ToggleButtons(\n", |
|
422 | "widgets.ToggleButtons(\n", | |
423 | " description='Speed:',\n", |
|
423 | " description='Speed:',\n", | |
424 | " values=['Slow', 'Regular', 'Fast'],\n", |
|
424 | " values=['Slow', 'Regular', 'Fast'],\n", | |
425 | ")" |
|
425 | ")" | |
426 | ] |
|
426 | ] | |
427 | }, |
|
427 | }, | |
428 | { |
|
428 | { | |
429 | "cell_type": "markdown", |
|
429 | "cell_type": "markdown", | |
430 | "metadata": { |
|
430 | "metadata": { | |
431 | "slideshow": { |
|
431 | "slideshow": { | |
432 | "slide_type": "slide" |
|
432 | "slide_type": "slide" | |
433 | } |
|
433 | } | |
434 | }, |
|
434 | }, | |
435 | "source": [ |
|
435 | "source": [ | |
436 | "## String widgets" |
|
436 | "## String widgets" | |
437 | ] |
|
437 | ] | |
438 | }, |
|
438 | }, | |
439 | { |
|
439 | { | |
440 | "cell_type": "markdown", |
|
440 | "cell_type": "markdown", | |
441 | "metadata": {}, |
|
441 | "metadata": {}, | |
442 | "source": [ |
|
442 | "source": [ | |
443 | "There are 4 widgets that can be used to display a string value. Of those, the **`Text` and `Textarea` widgets accept input**. The **`Latex` and `HTML` widgets display the string** as either Latex or HTML respectively, but **do not accept input**." |
|
443 | "There are 4 widgets that can be used to display a string value. Of those, the **`Text` and `Textarea` widgets accept input**. The **`Latex` and `HTML` widgets display the string** as either Latex or HTML respectively, but **do not accept input**." | |
444 | ] |
|
444 | ] | |
445 | }, |
|
445 | }, | |
446 | { |
|
446 | { | |
447 | "cell_type": "markdown", |
|
447 | "cell_type": "markdown", | |
448 | "metadata": { |
|
448 | "metadata": { | |
449 | "slideshow": { |
|
449 | "slideshow": { | |
450 | "slide_type": "slide" |
|
450 | "slide_type": "slide" | |
451 | } |
|
451 | } | |
452 | }, |
|
452 | }, | |
453 | "source": [ |
|
453 | "source": [ | |
454 | "### Text" |
|
454 | "### Text" | |
455 | ] |
|
455 | ] | |
456 | }, |
|
456 | }, | |
457 | { |
|
457 | { | |
458 | "cell_type": "code", |
|
458 | "cell_type": "code", | |
459 | "execution_count": null, |
|
459 | "execution_count": null, | |
460 | "metadata": { |
|
460 | "metadata": { | |
461 | "collapsed": false |
|
461 | "collapsed": false | |
462 | }, |
|
462 | }, | |
463 | "outputs": [], |
|
463 | "outputs": [], | |
464 | "source": [ |
|
464 | "source": [ | |
465 | "widgets.Text(\n", |
|
465 | "widgets.Text(\n", | |
466 | " description='String:',\n", |
|
466 | " description='String:',\n", | |
467 | " value='Hello World',\n", |
|
467 | " value='Hello World',\n", | |
468 | ")" |
|
468 | ")" | |
469 | ] |
|
469 | ] | |
470 | }, |
|
470 | }, | |
471 | { |
|
471 | { | |
472 | "cell_type": "markdown", |
|
472 | "cell_type": "markdown", | |
473 | "metadata": {}, |
|
473 | "metadata": {}, | |
474 | "source": [ |
|
474 | "source": [ | |
475 | "### Textarea" |
|
475 | "### Textarea" | |
476 | ] |
|
476 | ] | |
477 | }, |
|
477 | }, | |
478 | { |
|
478 | { | |
479 | "cell_type": "code", |
|
479 | "cell_type": "code", | |
480 | "execution_count": null, |
|
480 | "execution_count": null, | |
481 | "metadata": { |
|
481 | "metadata": { | |
482 | "collapsed": false |
|
482 | "collapsed": false | |
483 | }, |
|
483 | }, | |
484 | "outputs": [], |
|
484 | "outputs": [], | |
485 | "source": [ |
|
485 | "source": [ | |
486 | "widgets.Textarea(\n", |
|
486 | "widgets.Textarea(\n", | |
487 | " description='String:',\n", |
|
487 | " description='String:',\n", | |
488 | " value='Hello World',\n", |
|
488 | " value='Hello World',\n", | |
489 | ")" |
|
489 | ")" | |
490 | ] |
|
490 | ] | |
491 | }, |
|
491 | }, | |
492 | { |
|
492 | { | |
493 | "cell_type": "markdown", |
|
493 | "cell_type": "markdown", | |
494 | "metadata": { |
|
494 | "metadata": { | |
495 | "slideshow": { |
|
495 | "slideshow": { | |
496 | "slide_type": "slide" |
|
496 | "slide_type": "slide" | |
497 | } |
|
497 | } | |
498 | }, |
|
498 | }, | |
499 | "source": [ |
|
499 | "source": [ | |
500 | "### Latex" |
|
500 | "### Latex" | |
501 | ] |
|
501 | ] | |
502 | }, |
|
502 | }, | |
503 | { |
|
503 | { | |
504 | "cell_type": "code", |
|
504 | "cell_type": "code", | |
505 | "execution_count": null, |
|
505 | "execution_count": null, | |
506 | "metadata": { |
|
506 | "metadata": { | |
507 | "collapsed": false |
|
507 | "collapsed": false | |
508 | }, |
|
508 | }, | |
509 | "outputs": [], |
|
509 | "outputs": [], | |
510 | "source": [ |
|
510 | "source": [ | |
511 | "widgets.Latex(\n", |
|
511 | "widgets.Latex(\n", | |
512 | " value=\"$$\\\\frac{n!}{k!(n-k)!} = \\\\binom{n}{k}$$\",\n", |
|
512 | " value=\"$$\\\\frac{n!}{k!(n-k)!} = \\\\binom{n}{k}$$\",\n", | |
513 | ")" |
|
513 | ")" | |
514 | ] |
|
514 | ] | |
515 | }, |
|
515 | }, | |
516 | { |
|
516 | { | |
517 | "cell_type": "markdown", |
|
517 | "cell_type": "markdown", | |
518 | "metadata": {}, |
|
518 | "metadata": {}, | |
519 | "source": [ |
|
519 | "source": [ | |
520 | "### HTML" |
|
520 | "### HTML" | |
521 | ] |
|
521 | ] | |
522 | }, |
|
522 | }, | |
523 | { |
|
523 | { | |
524 | "cell_type": "code", |
|
524 | "cell_type": "code", | |
525 | "execution_count": null, |
|
525 | "execution_count": null, | |
526 | "metadata": { |
|
526 | "metadata": { | |
527 | "collapsed": false |
|
527 | "collapsed": false | |
528 | }, |
|
528 | }, | |
529 | "outputs": [], |
|
529 | "outputs": [], | |
530 | "source": [ |
|
530 | "source": [ | |
531 | "widgets.HTML(\n", |
|
531 | "widgets.HTML(\n", | |
532 | " value=\"Hello <b>World</b>\"\n", |
|
532 | " value=\"Hello <b>World</b>\"\n", | |
533 | ")" |
|
533 | ")" | |
534 | ] |
|
534 | ] | |
535 | }, |
|
535 | }, | |
536 | { |
|
536 | { | |
537 | "cell_type": "markdown", |
|
537 | "cell_type": "markdown", | |
538 | "metadata": { |
|
538 | "metadata": { | |
539 | "slideshow": { |
|
539 | "slideshow": { | |
540 | "slide_type": "slide" |
|
540 | "slide_type": "slide" | |
541 | } |
|
541 | } | |
542 | }, |
|
542 | }, | |
543 | "source": [ |
|
543 | "source": [ | |
544 | "## Button" |
|
544 | "## Button" | |
545 | ] |
|
545 | ] | |
546 | }, |
|
546 | }, | |
547 | { |
|
547 | { | |
548 | "cell_type": "code", |
|
548 | "cell_type": "code", | |
549 | "execution_count": null, |
|
549 | "execution_count": null, | |
550 | "metadata": { |
|
550 | "metadata": { | |
551 | "collapsed": false |
|
551 | "collapsed": false | |
552 | }, |
|
552 | }, | |
553 | "outputs": [], |
|
553 | "outputs": [], | |
554 | "source": [ |
|
554 | "source": [ | |
555 | "widgets.Button(description='Click me')" |
|
555 | "widgets.Button(description='Click me')" | |
556 | ] |
|
556 | ] | |
557 | }, |
|
557 | }, | |
558 | { |
|
558 | { | |
559 | "cell_type": "markdown", |
|
559 | "cell_type": "markdown", | |
560 | "metadata": {}, |
|
560 | "metadata": {}, | |
561 | "source": [ |
|
561 | "source": [ | |
562 | "[Index](Index.ipynb) - [Back](Widget Basics.ipynb) - [Next](Widget Events.ipynb)" |
|
562 | "[Index](Index.ipynb) - [Back](Widget Basics.ipynb) - [Next](Widget Events.ipynb)" | |
563 | ] |
|
563 | ] | |
564 | } |
|
564 | } | |
565 | ], |
|
565 | ], | |
566 | "metadata": { |
|
566 | "metadata": { | |
567 | "kernelspec": { |
|
567 | "kernelspec": { | |
568 | "codemirror_mode": { |
|
|||
569 | "name": "python", |
|
|||
570 | "version": 2 |
|
|||
571 | }, |
|
|||
572 | "display_name": "Python 2", |
|
568 | "display_name": "Python 2", | |
573 | "language": "python", |
|
|||
574 | "name": "python2" |
|
569 | "name": "python2" | |
575 | }, |
|
570 | }, | |
576 | "signature": "sha256:83b39d018a7a6ae0a324b9f3d38debafbfb2ed0a114e4bbd357fb318f8f23438" |
|
571 | "language_info": { | |
|
572 | "codemirror_mode": { | |||
|
573 | "name": "ipython", | |||
|
574 | "version": 2 | |||
|
575 | }, | |||
|
576 | "file_extension": ".py", | |||
|
577 | "mimetype": "text/x-python", | |||
|
578 | "name": "python", | |||
|
579 | "nbconvert_exporter": "python", | |||
|
580 | "pygments_lexer": "ipython2", | |||
|
581 | "version": "2.7.8" | |||
|
582 | } | |||
577 | }, |
|
583 | }, | |
578 | "nbformat": 4, |
|
584 | "nbformat": 4, | |
579 | "nbformat_minor": 0 |
|
585 | "nbformat_minor": 0 | |
580 | } |
|
586 | } |
General Comments 0
You need to be logged in to leave comments.
Login now