-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathusage.py
57 lines (49 loc) · 2.7 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
from dash import Dash, Input, Output, html
from dash_signature import Signature # , Test
app = Dash(__name__)
value_store = ""
app.layout = html.Div(
[
Signature(
id="input_signature",
value="",
defaultValue="",
),
html.Button(
"Simulate DB Get Value",
style={
"margin": "10px",
"padding": "10px",
"backgroundColor": "lightblue",
"border": "1px solid black",
},
id="store-button",
),
html.Div(
id="output",
style={
"overflowWrap": "anywhere",
"backgroundColor": "lightgrey",
"width": "1000px",
},
),
],
id="container",
style={"width": "600px"},
)
@app.callback(
Output("output", "children"),
Input("input_signature", "value"),
)
def update_output(value):
return f"""Length: {0 if value is None else len(value)}
{value}"""
@app.callback(
Output("input_signature", "defaultValue"),
Input("store-button", "n_clicks"),
)
def store_value(n_clicks):
if n_clicks is not None and n_clicks > 0:
return "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgNjAwIDI0MCIgd2lkdGg9IjYwMCIgaGVpZ2h0PSIyNDAiPjxwYXRoIGQ9Ik0gMjI1LjAwMCwxNTMuMDAwIEMgMjI5LjUwMCwxNTMuMDAwIDIyOS41MDAsMTUzLjAwMCAyMzQuMDAwLDE1My4wMDAiIHN0cm9rZS13aWR0aD0iNS40MTIiIHN0cm9rZT0iYmxhY2siIGZpbGw9Im5vbmUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCI+PC9wYXRoPjxwYXRoIGQ9Ik0gMjM0LjAwMCwxNTMuMDAwIEMgMjQxLjAxNywxNTMuMzA0IDI0MS4wMDAsMT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