widget layout
rodzic
b83c487bfc
commit
48aceedf19
|
@ -107,7 +107,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 29,
|
||||
"id": "2f3b63fd-d5ea-40b6-a2f9-b31c84cfef36",
|
||||
"metadata": {
|
||||
"extensions": {
|
||||
|
@ -129,20 +129,25 @@
|
|||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "68aa2b284295445fbd69f50a344827cc",
|
||||
"model_id": "b0fd2ea17df240dab9321a1d81ca8da9",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
"text/plain": [
|
||||
"interactive(children=(FloatSlider(value=2.0, description='Width [m]:', layout=Layout(width='500px'), max=5.0, …"
|
||||
"VBox(children=(FloatSlider(value=2.0, description='Width [m]:', layout=Layout(width='500px'), max=5.0, min=0.1…"
|
||||
]
|
||||
},
|
||||
"execution_count": 29,
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"def f(width,height,depth,airTemp,hotAirTemp,coatDens):\n",
|
||||
" \n",
|
||||
" \n",
|
||||
" out=widgets.Output(layout={'margin': '10px 10px 10px 10px'}) \n",
|
||||
" with out: \n",
|
||||
" print(\"\\n\")\n",
|
||||
" # Volume\n",
|
||||
" volume = width * height * depth\n",
|
||||
|
@ -172,6 +177,7 @@
|
|||
" print( \"Free lift force:\", colored(\"{:.2f} [g]\".format(freeLiftForce),color)) \n",
|
||||
" print(\"\\n\")\n",
|
||||
"\n",
|
||||
" \n",
|
||||
" box = Mesh(geometry=BoxBufferGeometry(\n",
|
||||
" width=width, \n",
|
||||
" height=height, \n",
|
||||
|
@ -193,7 +199,10 @@
|
|||
" clearOpacity=1.0,\n",
|
||||
" clearColor='#62a0ea',\n",
|
||||
" controls=[OrbitControls(controlling=c)])\n",
|
||||
" return renderer\n",
|
||||
" \n",
|
||||
" display(widgets.HBox([renderer, out])) \n",
|
||||
"# return renderer\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"#display(HTML('''<style>\n",
|
||||
"# .widget-label { min-width: 25ex !important; }\n",
|
||||
|
@ -202,23 +211,27 @@
|
|||
"layout=Layout(width='500px')\n",
|
||||
"style = {'description_width': 'initial'}\n",
|
||||
" \n",
|
||||
"widgets.interact(f, \n",
|
||||
" width=widgets.FloatSlider(min=0.1, max=5.0, step=0.1, value=2.0, description='Width [m]:',readout_format='.1f',layout=layout,style=style), \n",
|
||||
" height=widgets.FloatSlider(min=0.1, max=5.0, step=0.1, value=2.0, description='Height [m]:',readout_format='.1f',layout=layout,style=style), \n",
|
||||
" depth=widgets.FloatSlider(min=0.1, max=5.0, step=0.1, value=2.0, description='Depth [m]:',readout_format='.1f',layout=layout,style=style),\n",
|
||||
" airTemp=widgets.FloatSlider(min=-40, max=35, step=1.0, value=10.0, description='Air temp.[°C]:',readout_format='.0f',layout=layout,style=style), \n",
|
||||
" hotAirTemp=widgets.FloatSlider(min=-40, max=55, step=1.0, value=35.0, description='Hot air temp.[°C]:',readout_format='.0f',layout=layout,style=style),\n",
|
||||
"width=widgets.FloatSlider(min=0.1, max=5.0, step=0.1, value=2.0, description='Width [m]:',readout_format='.1f',layout=layout,style=style) \n",
|
||||
"height=widgets.FloatSlider(min=0.1, max=5.0, step=0.1, value=2.0, description='Height [m]:',readout_format='.1f',layout=layout,style=style) \n",
|
||||
"depth=widgets.FloatSlider(min=0.1, max=5.0, step=0.1, value=2.0, description='Depth [m]:',readout_format='.1f',layout=layout,style=style)\n",
|
||||
"airTemp=widgets.FloatSlider(min=-40, max=35, step=1.0, value=10.0, description='Air temp.[°C]:',readout_format='.0f',layout=layout,style=style) \n",
|
||||
"hotAirTemp=widgets.FloatSlider(min=-40, max=55, step=1.0, value=35.0, description='Hot air temp.[°C]:',readout_format='.0f',layout=layout,style=style)\n",
|
||||
"coatDens=widgets.FloatSlider(min=1, max=50, step=1.0, value=15.0, description='Coating density [g/m2]:',readout_format='.0f',layout=layout,style=style) \n",
|
||||
" );\n"
|
||||
"\n",
|
||||
"\n",
|
||||
"w = widgets.interactive_output(f, {\n",
|
||||
" 'width' : width,\n",
|
||||
" 'height' : height,\n",
|
||||
" 'depth' : depth,\n",
|
||||
" 'airTemp' : airTemp,\n",
|
||||
" 'hotAirTemp' : hotAirTemp,\n",
|
||||
" 'coatDens' : coatDens\n",
|
||||
" }\n",
|
||||
" )\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"widgets.VBox([width, height, depth, airTemp, hotAirTemp, coatDens, w])\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "f57a4d40-ce23-4f32-941a-e085689fa6cf",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
|
Ładowanie…
Reference in New Issue