Skip to content

Commit abe1f26

Browse files
committed
Add ipywidgets 8 notebook
Signed-off-by: Itay Dafna <[email protected]>
1 parent f6ef08e commit abe1f26

File tree

1 file changed

+287
-0
lines changed

1 file changed

+287
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,287 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "533dd758-2834-4fa8-b7cc-b5a1ab74256c",
6+
"metadata": {},
7+
"source": [
8+
"# ipywidgets 8"
9+
]
10+
},
11+
{
12+
"cell_type": "markdown",
13+
"id": "b1c209d4-8dfe-45fd-9b55-b69f8d5e0963",
14+
"metadata": {},
15+
"source": [
16+
"### Currently in release candidate stage, but coming *very* soon!"
17+
]
18+
},
19+
{
20+
"cell_type": "markdown",
21+
"id": "174e8fce-147d-4470-bbd8-5bacd35f3f55",
22+
"metadata": {},
23+
"source": [
24+
"#### Full changelog in the link below\n",
25+
"[ipywidgets 8 changelog](https://github.com/jupyter-widgets/ipywidgets/blob/master/docs/source/changelog.md)"
26+
]
27+
},
28+
{
29+
"cell_type": "markdown",
30+
"id": "8d1c293b-9eee-4355-af38-34a997efaf44",
31+
"metadata": {},
32+
"source": [
33+
"#### In this session will cover some of the main changes in ipywidgets 8 for both users and developers"
34+
]
35+
},
36+
{
37+
"cell_type": "code",
38+
"execution_count": 3,
39+
"id": "a0881c40-c4b0-434d-a1a4-857cba969601",
40+
"metadata": {},
41+
"outputs": [],
42+
"source": [
43+
"import ipywidgets as widgets"
44+
]
45+
},
46+
{
47+
"cell_type": "code",
48+
"execution_count": 4,
49+
"id": "a89234b0-b0a0-46d3-8567-97465d69dff4",
50+
"metadata": {},
51+
"outputs": [
52+
{
53+
"data": {
54+
"text/plain": [
55+
"'8.0.0rc1'"
56+
]
57+
},
58+
"execution_count": 4,
59+
"metadata": {},
60+
"output_type": "execute_result"
61+
}
62+
],
63+
"source": [
64+
"widgets.__version__"
65+
]
66+
},
67+
{
68+
"cell_type": "markdown",
69+
"id": "a407df5a-d525-46f7-adf2-fac35c2b9d8a",
70+
"metadata": {},
71+
"source": [
72+
"#### Python 2.x and <=3.5 is not supported in ipywidgets 8."
73+
]
74+
},
75+
{
76+
"cell_type": "markdown",
77+
"id": "b35372a7-dc80-48f5-9c03-f7d59c52c59e",
78+
"metadata": {},
79+
"source": [
80+
"#### New styling attributes support for core widgets:\n",
81+
"1. `font-family` \n",
82+
"2. `font-size`\n",
83+
"3. `font-style`\n",
84+
"4. `font-variant`\n",
85+
"5. `text-color`\n",
86+
"6. `text-decoration`"
87+
]
88+
},
89+
{
90+
"cell_type": "code",
91+
"execution_count": 53,
92+
"id": "dbe91b98-bb7a-4292-8df0-efbc49fdfef0",
93+
"metadata": {},
94+
"outputs": [
95+
{
96+
"data": {
97+
"application/vnd.jupyter.widget-view+json": {
98+
"model_id": "554101bd5a314be4bcefc9f34465a7e3",
99+
"version_major": 2,
100+
"version_minor": 0
101+
},
102+
"text/plain": [
103+
"VBox(children=(HBox(children=(Combobox(value='option B', options=('option A', 'option B', 'Another option'), s…"
104+
]
105+
},
106+
"execution_count": 53,
107+
"metadata": {},
108+
"output_type": "execute_result"
109+
}
110+
],
111+
"source": [
112+
"from ipywidgets import ToggleButton, Checkbox, Button, HTML, HTMLMath, Label, Textarea, Password, Combobox, HBox, VBox\n",
113+
"\n",
114+
"checkbox = Checkbox(description='Option A', style=dict(background='lightblue'))\n",
115+
"valid = Valid(value=False, style=dict(background='lightblue'))\n",
116+
"togglebutton = ToggleButton(description=\"Option A\", style=dict(\n",
117+
" background='lightblue',\n",
118+
" font_family=\"Times New Roman\",\n",
119+
" font_size=\"20px\",\n",
120+
" font_style=\"italic\",\n",
121+
" font_variant=\"small-caps\",\n",
122+
" font_weight=\"bold\",\n",
123+
" text_color=\"red\",\n",
124+
" text_decoration=\"underline\",\n",
125+
"))\n",
126+
"\n",
127+
"button = Button(description=\"Button\", style=dict(\n",
128+
" button_color=\"lightblue\",\n",
129+
" font_family=\"Times New Roman\",\n",
130+
" font_size=\"20px\",\n",
131+
" font_style=\"italic\",\n",
132+
" font_variant=\"small-caps\",\n",
133+
" font_weight=\"bold\",\n",
134+
" text_color=\"red\",\n",
135+
" text_decoration=\"underline\",\n",
136+
"))\n",
137+
"\n",
138+
"html = HTML(value='Some HTML text',style=dict(\n",
139+
" background=\"lightblue\",\n",
140+
" font_size=\"30px\",\n",
141+
" text_color=\"red\"\n",
142+
"))\n",
143+
"\n",
144+
"htmlmath = HTMLMath(value='Some HTML text and math: $$\\int \\sqrt{x^2} dx$$',style=dict(\n",
145+
" background=\"lightblue\",\n",
146+
" font_size=\"30px\",\n",
147+
" text_color=\"red\"\n",
148+
"))\n",
149+
"\n",
150+
"label = Label(value=\"Label text\", style=dict(\n",
151+
" background='limegreen',\n",
152+
" font_family=\"Times New Roman\",\n",
153+
" font_size=\"20px\",\n",
154+
" font_style=\"italic\",\n",
155+
" font_variant=\"small-caps\",\n",
156+
" font_weight=\"bold\",\n",
157+
" text_color=\"red\",\n",
158+
" text_decoration=\"underline\",\n",
159+
"))\n",
160+
"\n",
161+
"textarea = Textarea(value='Text area text',style=dict(\n",
162+
" background=\"lightblue\",\n",
163+
" font_size=\"30px\",\n",
164+
" text_color=\"red\"\n",
165+
"))\n",
166+
"\n",
167+
"text = Text(value='Text area text',style=dict(\n",
168+
" background=\"lightblue\",\n",
169+
" font_size=\"30px\",\n",
170+
" text_color=\"red\"\n",
171+
"))\n",
172+
"\n",
173+
"password = Password(value='Text area text',style=dict(\n",
174+
" background=\"lightblue\",\n",
175+
" font_size=\"30px\",\n",
176+
" text_color=\"red\"\n",
177+
"))\n",
178+
"\n",
179+
"combobox = Combobox(value='option B', options=['option A', 'option B', 'Another option'], style=dict(\n",
180+
" background=\"lightblue\",\n",
181+
" font_size=\"30px\",\n",
182+
" text_color=\"red\"\n",
183+
"))\n",
184+
"\n",
185+
"\n",
186+
"VBox([\n",
187+
" HBox([combobox, password, text, textarea]),\n",
188+
" HBox([label, htmlmath, html, button]),\n",
189+
" HBox([togglebutton, valid, checkbox]),\n",
190+
"])"
191+
]
192+
},
193+
{
194+
"cell_type": "markdown",
195+
"id": "674f2b43-a0af-4184-88fa-9664d71f01bf",
196+
"metadata": {},
197+
"source": [
198+
"#### Layout widgets now support setting each border side independently:\n",
199+
"1. `border_top`\n",
200+
"2. `border_right`\n",
201+
"3. `border_bottom`\n",
202+
"4. `border_left`"
203+
]
204+
},
205+
{
206+
"cell_type": "code",
207+
"execution_count": 43,
208+
"id": "22dd3054-3c92-4377-b708-542bd7f4db4e",
209+
"metadata": {},
210+
"outputs": [
211+
{
212+
"data": {
213+
"application/vnd.jupyter.widget-view+json": {
214+
"model_id": "661df8350d804df79494075c43f4a2f9",
215+
"version_major": 2,
216+
"version_minor": 0
217+
},
218+
"text/plain": [
219+
"Button(layout=Layout(border_bottom='5px solid red', border_left='5px solid green', border_right='5px solid blu…"
220+
]
221+
},
222+
"execution_count": 43,
223+
"metadata": {},
224+
"output_type": "execute_result"
225+
}
226+
],
227+
"source": [
228+
"from ipywidgets import Button, Layout\n",
229+
"btn = widgets.Button(layout=Layout(border_left=\"5px solid green\", border_right=\"5px solid blue\", border_top=\"5px solid yellow\", border_bottom=\"5px solid red\"))\n",
230+
"btn"
231+
]
232+
},
233+
{
234+
"cell_type": "markdown",
235+
"id": "331dfbc1-aab3-4e11-858f-d3c8c66d9793",
236+
"metadata": {},
237+
"source": [
238+
"#### New slider implementation based on `nouislider` with support for range dragging."
239+
]
240+
},
241+
{
242+
"cell_type": "markdown",
243+
"id": "709e5005-1569-4232-a618-5bde081247db",
244+
"metadata": {},
245+
"source": [
246+
"#### Tooltip for any HTML-based widget"
247+
]
248+
},
249+
{
250+
"cell_type": "markdown",
251+
"id": "26d3119f-374a-4e11-a96f-c7692838f760",
252+
"metadata": {},
253+
"source": [
254+
"#### ErrorWidget fallback when widget models or views fail."
255+
]
256+
},
257+
{
258+
"cell_type": "code",
259+
"execution_count": null,
260+
"id": "bec074df-80ab-4b9f-855e-e9bae4d8b1b5",
261+
"metadata": {},
262+
"outputs": [],
263+
"source": []
264+
}
265+
],
266+
"metadata": {
267+
"kernelspec": {
268+
"display_name": "Python 3 (ipykernel)",
269+
"language": "python",
270+
"name": "python3"
271+
},
272+
"language_info": {
273+
"codemirror_mode": {
274+
"name": "ipython",
275+
"version": 3
276+
},
277+
"file_extension": ".py",
278+
"mimetype": "text/x-python",
279+
"name": "python",
280+
"nbconvert_exporter": "python",
281+
"pygments_lexer": "ipython3",
282+
"version": "3.9.13"
283+
}
284+
},
285+
"nbformat": 4,
286+
"nbformat_minor": 5
287+
}

0 commit comments

Comments
 (0)