Created
March 20, 2018 23:19
-
-
Save jasongrout/734ebc3b22ef45d2afce76fa842ca29b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/docs/source/examples/Widget Styling.ipynb b/docs/source/examples/Widget Styling.ipynb | |
index 0ac7a28d..70963f81 100644 | |
--- a/docs/source/examples/Widget Styling.ipynb | |
+++ b/docs/source/examples/Widget Styling.ipynb | |
@@ -534,8 +534,7 @@ | |
"source": [ | |
"from ipywidgets import Layout, Button, Box\n", | |
"\n", | |
- "items_layout = Layout(flex='1 1 auto',\n", | |
- " width='auto') # override the default width of the button to 'auto' to let the button grow\n", | |
+ "items_layout = Layout( width='auto') # override the default width of the button to 'auto' to let the button grow\n", | |
"\n", | |
"box_layout = Layout(display='flex',\n", | |
" flex_flow='column', \n", | |
@@ -544,7 +543,7 @@ | |
" width='50%')\n", | |
"\n", | |
"words = ['correct', 'horse', 'battery', 'staple']\n", | |
- "items = [Button(description=w, layout=items_layout, button_style='danger') for w in words]\n", | |
+ "items = [Button(description=word, layout=items_layout, button_style='danger') for word in words]\n", | |
"box = Box(children=items, layout=box_layout)\n", | |
"box" | |
] | |
@@ -577,21 +576,28 @@ | |
} | |
], | |
"source": [ | |
- "from ipywidgets import Layout, Button, Box\n", | |
+ "from ipywidgets import Layout, Button, Box, VBox\n", | |
"\n", | |
- "items = [\n", | |
- " Button(description='weight=1'),\n", | |
- " Button(description='weight=2', layout=Layout(flex='2 1 auto', width='auto')),\n", | |
- " Button(description='weight=1'),\n", | |
+ "# Items flex proportionallly to the weight and the left over space around the text \n", | |
+ "items_auto = [\n", | |
+ " Button(description='weight=1, auto', layout=Layout(flex='1 1 auto', width='auto'), button_style='danger'),\n", | |
+ " Button(description='weight=3, auto', layout=Layout(flex='3 1 auto', width='auto'), button_style='danger'),\n", | |
+ " Button(description='weight=1, auto', layout=Layout(flex='1 1 auto', width='auto'), button_style='danger'),\n", | |
" ]\n", | |
"\n", | |
+ "# Items flex proportionallly to the weight \n", | |
+ "items_0 = [\n", | |
+ " Button(description='weight=1, _0%', layout=Layout(flex='1 1 0%', width='auto'), button_style='danger'),\n", | |
+ " Button(description='weight=3, _0%', layout=Layout(flex='3 1 0%', width='auto'), button_style='danger'),\n", | |
+ " Button(description='weight=1, _0%', layout=Layout(flex='1 1 0%', width='auto'), button_style='danger'),\n", | |
+ " ]\n", | |
"box_layout = Layout(display='flex',\n", | |
" flex_flow='row', \n", | |
" align_items='stretch', \n", | |
- " border='solid',\n", | |
- " width='50%')\n", | |
- "box = Box(children=items, layout=box_layout)\n", | |
- "box" | |
+ " width='70%')\n", | |
+ "box_auto = Box(children=items_auto, layout=box_layout)\n", | |
+ "box_0 = Box(children=items_0, layout=box_layout)\n", | |
+ "VBox([box_auto, box_0])" | |
] | |
}, | |
{ | |
@@ -688,7 +694,7 @@ | |
" border='3px solid black',\n", | |
" width='500px',\n", | |
" height='',\n", | |
- " flex_direction='row',\n", | |
+ " flex_flow='row',\n", | |
" display='flex')\n", | |
"carousel = Box(children=items, layout=box_layout)\n", | |
"VBox([Label('Scroll horizontally:'), carousel])" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment