fix box for providing room dimensions

This commit is contained in:
markus 2020-10-22 10:40:40 +02:00
parent ba257465c4
commit bdf9614f6a

View file

@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 49,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
@ -11,7 +11,7 @@
},
{
"cell_type": "code",
"execution_count": 68,
"execution_count": 5,
"metadata": {
"pycharm": {
"name": "#%%\n"
@ -24,7 +24,7 @@
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "61c53e6d9b58415097dce93a3a0e96c7"
"model_id": "b6dfcf9858f24a84bf9bac4918b328a5"
}
},
"metadata": {},
@ -41,36 +41,28 @@
},
{
"cell_type": "code",
"execution_count": 74,
"execution_count": 20,
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"data": {
"text/plain": "VBox(children=(Text(value='', placeholder='Room volume (m³)'), Label(value='OR'), Text(value='', placeholder='…",
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "bea9900594a14d078ab222436b922b5e"
}
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"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",
"\n",
"w.jslink((volume_text, 'value'), (area_text, 'disabled'))\n",
"w.jslink((volume_text, 'value'), (height_text, 'disabled'))\n",
"w.jslink((area_text, 'value'), (volume_text, 'disabled'))\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",
"def manage_text_fields(b):\n",
" volume_text.disabled = bool(area_text.value) or bool(height_text.value)\n",
" area_text.disabled = bool(volume_text.value)\n",
" height_text.disabled = bool(volume_text.value)\n",
"\n",
"w.VBox(children=(volume_text, w.Label(value=\"OR\"),area_text, height_text), layout=w.Layout(align_items='center'))"
"volume_text.observe(manage_text_fields)\n",
"area_text.observe(manage_text_fields)\n",
"height_text.observe(manage_text_fields)"
]
}
],