-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_file.py
73 lines (64 loc) · 1.93 KB
/
example_file.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
73
# -*- coding: utf-8 -*-
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_canvas as dc
from dash.dependencies import Input, Output, State
import vtk_python_script as vps
from flask import send_file
# import vtk
asset_style = ['assets/style.css']
js_script = [
{'src': 'https://unpkg.com/vtk.js@14.10.1/dist/vtk.js'}]
app = dash.Dash(
__name__,
external_stylesheets=asset_style)
# HTTPS addresses generation for additional JS/HTML scripts
# use send_file from flask to send the new HTTPS path to files
app.layout = html.Div(children=[
html.H1(children='Hello Dash'),
html.Div(children='''
Dash: A web application framework for Python
'''),
dcc.RangeSlider(id="slider", className="slider"),
dcc.Graph(
id='example-graph',
figure={
'data': [
{'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name': 'SF'},
{'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name': u'Montréal'},
],
'layout': {
'title': 'Dash Data Visualization'
}
}
),
html.H5("Dash Cnavas testing"),
# dc.DashCanvas(id='canvas-1')
# html.Canvas(id="html-canvas"),
# Testing different src for iframe - local html file
html.Iframe(
src="https://kitware.github.io/vtk-js/examples/GeometryViewer/GeometryViewer.html",
# src="assets/geom_view.html",
height=300,
width=600),
dcc.Loading(
html.Button(id="test-button")
)
])
@app.callback(
Output('test-button', 'children'),
[Input('test-button', 'n_clicks')]
)
def testing_button(clicks):
print("number of clicks {}".format(clicks))
print()
output = "Start"
if clicks is None:
output = "Button"
else:
output = "Button {}".format(clicks)
vps.main()
return output
if __name__ == '__main__':
app.run_server(debug=True)