-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathusage.py
More file actions
58 lines (51 loc) · 1.25 KB
/
usage.py
File metadata and controls
58 lines (51 loc) · 1.25 KB
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
import dash_treebeard
import dash
from dash.dependencies import Input, Output
import dash_html_components as html
import json
from textwrap import dedent
app = dash.Dash(__name__)
data = {
"name": "root",
"key": "__root__",
"children": [
{
"key": "A",
"name": "A",
"children": [{"name": "1", "key": "A.1"}, {"name": "2", "key": "A.2"},],
},
{
"name": "B",
"key": "B",
"children": [
{
"name": "X",
"key": "B.X",
"children": [
{"name": "1", "key": "B.X.1"},
{"name": "2", "key": "B.X.2"},
],
},
],
},
],
}
app.layout = html.Div(
[
dash_treebeard.DashTreebeard(id="input", data=data, persistence=True),
html.Pre(id="output"),
]
)
@app.callback(
Output("output", "children"),
[Input("input", "selected"), Input("input", "toggled")],
)
def display_output(selected, toggled):
return dedent(
f"""
You have selected {selected}
You have toggled {toggled}
"""
)
if __name__ == "__main__":
app.run_server(debug=True)