use placeholder as prompt

This commit is contained in:
markus 2020-10-21 15:52:21 +02:00
parent aa229f4fb4
commit 5cf0c4787f

View file

@ -2,26 +2,31 @@
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 20,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from ipywidgets import Label, Layout, Text, VBox"
"import ipywidgets as w"
]
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 28,
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"data": {
"text/plain": "VBox(children=(Label(value='CARA Covid Calculator', layout=Layout(width='100%')), Text(value='', description='…",
"text/plain": "VBox(children=(Label(value='CARA Covid Calculator'), Text(value='', placeholder='Simulation name'), Text(value…",
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "81c2850558b347f0b3040231351aba9f"
"model_id": "9da199408f34408ca5ede050abe7858b"
}
},
"metadata": {},
@ -29,22 +34,26 @@
}
],
"source": [
"title = Label(\"CARA Covid Calculator\")\n",
"simulation_text = Text(\n",
" placeholder=\"E.g. Workshop without masks\",\n",
" description=\"Simulation name: \"\n",
")\n",
"room_number_text = Text(\n",
" placeholder=\"E.g. 17/R-033\",\n",
" description=\"Room number: \"\n",
")\n",
"intro = w.VBox(children=(w.Label(\"CARA Covid Calculator\"),\n",
" w.Text(placeholder=\"Simulation name\"),\n",
" w.Text(placeholder=\"Room number\")))\n",
"\n",
"intro = VBox(\n",
" children=(title, simulation_text, room_number_text)\n",
")\n",
"\n",
"intro\n"
"intro"
]
},
{
"cell_type": "code",
"execution_count": 29,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Text(value='test', placeholder='Simulation name')\n"
]
}
],
"source": [],
"metadata": {
"collapsed": false,
"pycharm": {
@ -62,16 +71,16 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
"pygments_lexer": "ipython3",
"version": "3.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 0
"nbformat_minor": 1
}