use style to make enough room for description
This commit is contained in:
parent
bdf9614f6a
commit
8cdd350157
1 changed files with 32 additions and 11 deletions
|
|
@ -11,7 +11,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": 42,
|
||||
"metadata": {
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
|
|
@ -20,11 +20,11 @@
|
|||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "VBox(children=(HTML(value='<font size=\"+2\"><b>CARA</b> Covid Calculator</font>'), Text(value='', placeholder='…",
|
||||
"text/plain": "VBox(children=(HTML(value='<font size=\"+2\"><b>CARA</b> Covid Calculator</font>'), Text(value='', description='…",
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"version_major": 2,
|
||||
"version_minor": 0,
|
||||
"model_id": "b6dfcf9858f24a84bf9bac4918b328a5"
|
||||
"model_id": "cb4016cbd61a455780fd5b7d9b8585db"
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
|
|
@ -33,25 +33,40 @@
|
|||
],
|
||||
"source": [
|
||||
"intro = w.VBox(children=(w.HTML(value='<font size=\"+2\"><b>CARA</b> Covid Calculator</font>'),\n",
|
||||
" w.Text(placeholder=\"Simulation name\"),\n",
|
||||
" w.Text(placeholder=\"Room number\")))\n",
|
||||
" w.Text(placeholder=\"E.g. Workshop without masks\", description=\"Simulation name:\",\n",
|
||||
" style={'description_width': '35%'}),\n",
|
||||
" w.Text(placeholder=\"E.g. 17/R-033\", description=\"Room number:\",\n",
|
||||
" style={'description_width': '35%'})))\n",
|
||||
"\n",
|
||||
"intro"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"execution_count": 34,
|
||||
"metadata": {
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "VBox(children=(Text(value='', description='Room volume', placeholder='Room volume (m³)', style=DescriptionStyl…",
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"version_major": 2,
|
||||
"version_minor": 0,
|
||||
"model_id": "152f11e8cd014cd5847392b559a4424b"
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"volume_text = w.Text(placeholder=\"Room volume (m³)\")\n",
|
||||
"area_text = w.Text(placeholder=\"Room floor area (m²)\")\n",
|
||||
"height_text = w.Text(placeholder=\"Room ceiling height (m²)\")\n",
|
||||
"volume_text = w.Text(placeholder=\"Room volume (m³)\", description=\"Room volume\")\n",
|
||||
"area_text = w.Text(placeholder=\"Room floor area (m²)\", description=\"Floor area\")\n",
|
||||
"height_text = w.Text(placeholder=\"Room ceiling height (m²)\", description=\"Ceiling height\")\n",
|
||||
"\n",
|
||||
"room_dimensions_box = w.VBox(children=(volume_text, w.Label(value=\"------- OR -------\"),area_text, height_text),\n",
|
||||
" layout=w.Layout(align_items='center'))\n",
|
||||
|
|
@ -60,9 +75,15 @@
|
|||
" area_text.disabled = bool(volume_text.value)\n",
|
||||
" height_text.disabled = bool(volume_text.value)\n",
|
||||
"\n",
|
||||
"for text in [volume_text, area_text, height_text]:\n",
|
||||
" text.observe(manage_text_fields)\n",
|
||||
" text.style.description_width = \"50%\"\n",
|
||||
"\n",
|
||||
"volume_text.observe(manage_text_fields)\n",
|
||||
"area_text.observe(manage_text_fields)\n",
|
||||
"height_text.observe(manage_text_fields)"
|
||||
"height_text.observe(manage_text_fields)\n",
|
||||
"\n",
|
||||
"room_dimensions_box"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
|
|
|||
Loading…
Reference in a new issue