-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathusage.py
72 lines (67 loc) · 1.53 KB
/
usage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import dash_mp_components as mpc
import dash
from dash.dependencies import Input, Output, State
from dash import dcc, html
from tests.scene import scene
import os
app = dash.Dash(__name__, suppress_callback_exceptions=True)
app.layout = html.Div(
[
html.Ul(
[
html.Li(mpc.Link("Home", href="/")),
html.Li(mpc.Link("Inputs", href="/inputs")),
]
),
html.Div(id="page-content"),
dcc.Location(id="mp-url", refresh=False),
]
)
@app.callback(
Output('page-content', 'children'),
Input('mp-url', 'pathname')
)
def get_page_content(path):
if path == '/inputs':
return html.Div(
[
mpc.Switch(
id="switch",
value=False
),
mpc.RangeSlider(
id="one",
domain=[-1, 2],
value=1,
step=0.1,
isLogScale=True
),
mpc.DualRangeSlider(
id="two",
domain=[-97, 88],
valueMin=1,
valueMax=5,
step=0.1
),
mpc.DualRangeSlider(
id="three",
domain=[-3, 2],
valueMin=1,
valueMax=2,
step=0.001,
isLogScale=True
),
html.Div(id='slider-output'),
]
)
else:
return html.Div("Select a page")
@app.callback(
Output('slider-output', 'children'),
Input('one', 'value')
)
def get_slider_value(value):
return value
# use True to load a dev build of react
if __name__ == '__main__':
app.run_server(debug=True, port=8051)