-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain_app.py
More file actions
82 lines (69 loc) · 2.28 KB
/
main_app.py
File metadata and controls
82 lines (69 loc) · 2.28 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import dash
from dash import Dash, dcc, callback, Output, State, Input, dash_table # pip install dash
# import dash_labs as dl # pip install dash-labs
import dash_bootstrap_components as dbc # pip install dash-bootstrap-components
from dash import html
import plotly.express as px
import pandas as pd
import os
from dash_bootstrap_templates import ThemeChangerAIO, template_from_url
# Instructions dash-labs is the worst library ever, please uninstall it and then continue ...
app = Dash(__name__, use_pages=True,external_stylesheets=[dbc.themes.MORPH],pages_folder="pages")
# for page in dash.page_registry.values():
# print(page)
# print("*"*100)
graph = html.Div(
html.Div([
dash.page_container
],
id="theme-changer-div",
className="m-4")
)
theme_change = ThemeChangerAIO(aio_id="theme")
# layout2 = html.Div(children = [
# dcc.Link(
# dbc.Button('BACK'),
# href='/',
# refresh = False
# ),
# html.H5(id='output',children=[]),
# dcc.Location(id='channel-url',refresh=False),
# ])
app.layout = dbc.Container([theme_change,graph],className = "m-4 dbc")
@app.callback(
Output("theme-changer-div","id"),
Input(ThemeChangerAIO.ids.radio("theme"),"value"),
)
def update_graph_theme(theme):
template=template_from_url(theme)
return template
# @app.callback(Output('page-content', 'children'),
# [Input('url', 'pathname')])
# def display_page(pathname):
# if pathname == '/apps/app1':
# return app1.layout
# elif pathname == '/apps/app2':
# return app2.layout
# else:
# return '404'
# navbar = dbc.NavbarSimple(
# dbc.Nav(
# [
# dbc.NavLink(page["name"], href=page["path"])
# for page in dash.page_registry.values()
# if page["module"] != "pages.not_found_404"
# ],
# ),
# brand="Multi Page App Demo: Query Strings",
# color="primary",
# dark=True,
# className="mb-2",
# )
# app.layout = dbc.Container(
# [dash.page_container],
# fluid=True,
# )
if __name__ == "__main__":
# app.config['suppress_callback_exceptions'] = True
# Dont do the above line to debug the errors in app efficiently using inbuilt-debugger
app.run_server(debug=True)