Skip to content

Commit 24a82e6

Browse files
authored
Merge pull request #182 from mwcraig/update-styling-8
Update styling tutorial notebooks with ipywidgets 8 notes
2 parents 5bad98c + fa61224 commit 24a82e6

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

notebooks/06.Layout/06.01-widget-layout-and-styling.ipynb

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,15 @@
9090
"b3"
9191
]
9292
},
93+
{
94+
"cell_type": "code",
95+
"execution_count": null,
96+
"metadata": {},
97+
"outputs": [],
98+
"source": [
99+
"b2.style.button_color = 'red'"
100+
]
101+
},
93102
{
94103
"cell_type": "markdown",
95104
"metadata": {},
@@ -201,7 +210,7 @@
201210
"<details>\n",
202211
"<summary><strong>Box model</strong></summary>\n",
203212
"\n",
204-
"- `border` \n",
213+
"- `border` -- changing in `ipywidgets 8`; will have four new properties `border_left`, `border_right`, `border_top` and `border_bottom`, to better match what CSS provides. `border` will still be available as a shortcut, but will not set a `border` CSS property.\n",
205214
"- `margin`\n",
206215
"- `padding`\n",
207216
"\n",
@@ -336,7 +345,7 @@
336345
"metadata": {},
337346
"outputs": [],
338347
"source": [
339-
"b1.layout. # fill this in, might take more than one line"
348+
"b1.layout. # fill this in, might take more than one line\n"
340349
]
341350
},
342351
{
@@ -674,7 +683,10 @@
674683
" layout=Layout(width='auto', height='auto'))\n",
675684
"min_slider = FloatSlider(min=-1, max=10, description=\"Min: \",\n",
676685
" layout=Layout(width='auto', height='auto'))\n",
677-
"app = TwoByTwoLayout(top_left=min_slider,\n",
686+
"\n",
687+
"# Set up two sliders and a graph. The \"max\" slider sets the upper limit for the \"min\" \n",
688+
"# slider, and the value of the \"min\" slider sets the upper limit for the \"max\" slider.\n",
689+
"bqfig = TwoByTwoLayout(top_left=min_slider,\n",
678690
" bottom_left=max_slider, \n",
679691
" bottom_right=fig,\n",
680692
" align_items=\"center\", \n",
@@ -686,7 +698,7 @@
686698
"jslink((max_slider, 'min'), (min_slider, 'value'))\n",
687699
"\n",
688700
"max_slider.value = 1.5\n",
689-
"app"
701+
"bqfig"
690702
]
691703
},
692704
{
@@ -786,7 +798,7 @@
786798
"metadata": {},
787799
"outputs": [],
788800
"source": [
789-
"# %load solutions/applayout-no-sides.py"
801+
"# %load solutions/applayout-no-sides.py\n"
790802
]
791803
},
792804
{
@@ -876,7 +888,7 @@
876888
"metadata": {},
877889
"outputs": [],
878890
"source": [
879-
"# %load solutions/slider-bqplot-sliders-app.py"
891+
"# %load solutions/slider-bqplot-sliders-app.py\n"
880892
]
881893
},
882894
{
@@ -1087,7 +1099,7 @@
10871099
"outputs": [],
10881100
"source": [
10891101
"GridBox(children=[Button(description=str(i), layout=Layout(width='auto', height='auto'),\n",
1090-
" style=ButtonStyle(button_color='darkseagreen')) for i in range(12)\n",
1102+
" style=ButtonStyle(button_color='darkseagreen')) for i in range(7)\n",
10911103
" ],\n",
10921104
" layout=Layout(\n",
10931105
" width='50%',\n",
@@ -1211,7 +1223,7 @@
12111223
"name": "python",
12121224
"nbconvert_exporter": "python",
12131225
"pygments_lexer": "ipython3",
1214-
"version": "3.8.10"
1226+
"version": "3.9.13"
12151227
}
12161228
},
12171229
"nbformat": 4,

notebooks/06.Layout/06.03-more-flexbox-layout.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@
327327
"metadata": {},
328328
"outputs": [],
329329
"source": [
330-
"from ipywidgets import Layout, Button, Box, Label\n",
330+
"from ipywidgets import Layout, Button, VBox, Label\n",
331331
"\n",
332332
"item_layout = Layout(height='100px', min_width='40px')\n",
333333
"items = [Button(layout=item_layout, description=str(i), button_style='warning') for i in range(40)]\n",

0 commit comments

Comments
 (0)