-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard_combined.py
More file actions
86 lines (81 loc) · 2.32 KB
/
Copy pathdashboard_combined.py
File metadata and controls
86 lines (81 loc) · 2.32 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
83
84
85
86
import dash
from dash import dcc, html
from dash.dependencies import Input, Output
app = dash.Dash(__name__, suppress_callback_exceptions=True)
app.title = "EA Sports Cricket Menu"
app.index_string = '''
<!DOCTYPE html>
<html>
<head>
{%metas%}
<title>{%title%}</title>
{%favicon%}
{%css%}
<style>
body {
background-image: url("/assets/menu_background.png");
background-size: cover;
background-repeat: no-repeat;
background-position: center;
font-family: 'Segoe UI', sans-serif;
}
.menu-box {
background-color: rgba(0, 0, 0, 0.6);
padding: 30px;
border-radius: 12px;
width: 400px;
margin: 180px auto;
text-align: center;
box-shadow: 0 4px 25px rgba(0,0,0,0.5);
color: white;
}
.menu-box h1 {
font-size: 32px;
margin-bottom: 25px;
color: #ffe600;
text-shadow: 2px 2px 5px #000;
}
.menu-box .dash-dropdown {
background-color: #222 !important;
border: 1px solid #555 !important;
color: #fff !important;
}
</style>
</head>
<body>
{%app_entry%}
<footer>
{%config%}
{%scripts%}
{%renderer%}
</footer>
</body>
</html>
'''
app.layout = html.Div([
dcc.Location(id='url-handler'),
html.Div([
html.H1("EA Sports Cricket 2007"),
dcc.Dropdown(
id='menu-dropdown',
options=[
{"label": "🏏 IPL Stats & Predictor", "value": "ipl"},
{"label": "🌍 T20I Stats & Predictor", "value": "t20"}
],
placeholder="Choose a Dashboard...",
className="dash-dropdown"
)
], className="menu-box")
])
@app.callback(
Output('url-handler', 'href'),
Input('menu-dropdown', 'value')
)
def open_dashboard(selection):
if selection == "ipl":
return "http://localhost:8050"
elif selection == "t20":
return "http://localhost:8501"
return dash.no_update
if __name__ == "__main__":
app.run(port=10004)