Advertisement
Guest User

Untitled

a guest
Apr 1st, 2020
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 9.35 KB | None | 0 0
  1. import dash
  2. import dash_core_components as dcc
  3. import dash_bootstrap_components as dbc
  4. import dash_html_components as html
  5. from dash.dependencies import Input, Output
  6. from win32api import GetSystemMetrics
  7.  
  8. app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
  9.  
  10. server = app.server
  11.  
  12. app.config.suppress_callback_exceptions = True
  13.  
  14. var1 = 3
  15. var2 = 4
  16. var3 = 5
  17.  
  18. height_screen = GetSystemMetrics(1)
  19. print("efgefe", height_screen)
  20.  
  21. app.layout = html.Div([
  22.     dcc.Tabs(
  23.         id="tabs-with-classes",
  24.         value='tab-1',
  25.         parent_className='custom-tabs',
  26.         className='custom-tabs-container',
  27.         children=[
  28.             dcc.Tab(
  29.                 label='World',
  30.                 value='tab-1',
  31.                 className='custom-tab',
  32.                 selected_className='custom-tab--selected'
  33.             ),
  34.             dcc.Tab(
  35.                 label= "Europe",
  36.                 value='tab-2',
  37.                 className='custom-tab',
  38.                 selected_className='custom-tab--selected'
  39.             ),
  40.             dcc.Tab(
  41.                 label='Graphs - TOP 10',
  42.                 value='tab-3', className='custom-tab',
  43.                 selected_className='custom-tab--selected'
  44.             ),
  45.             dcc.Tab(
  46.                 label='Graphs - TOP 10',
  47.                 value='tab-4',
  48.                 className='custom-tab',
  49.                 selected_className='custom-tab--selected'
  50.             ),
  51.             dcc.Tab(
  52.  
  53.                 label='Statistics',
  54.                 value='tab-5',
  55.                 className='custom-tab',
  56.                 selected_className='custom-tab--selected'
  57.  
  58.  
  59.  
  60.  
  61.  
  62.             ),
  63.         ]),
  64.     html.Div(id='tabs-content-classes')
  65. ])
  66.  
  67.  
  68. @app.callback(Output('tabs-content-classes', 'children'),
  69.               [Input('tabs-with-classes', 'value')])
  70.  
  71. def render_content(tab):
  72.     if tab == 'tab-1':
  73.         col = html.Div([
  74.             dbc.Row([
  75.                 dbc.Col([
  76.                     dbc.Row(
  77.                         dbc.Col(
  78.                             dbc.Alert([
  79.                                 html.H6("Last Updated at (M/D/YYYY)", style={"font-size": "13px","color":"#FFF","text-align": "center","margin-block-end":"1%"}),
  80.                                 html.P("3/31/2020 11:24:28 a.m.", style={"font-family": "Avenir Next W01" "Avenir Next W00" "Avenir Next" "Avenir" "Helvetica Neue" "sans-serif","font-weight":"bold","color":"#FFF","text-align": "center"}),
  81.                             ], color="#FFF", style={"background-color":"#232323","border": "2px solid gray","border-style": "groove","margin-block-start":"2%"})
  82.                         ),
  83.                     ),
  84.                     html.Div([
  85.                         dbc.Row(
  86.                             dbc.Col([
  87.                                 html.H4("Total Confirmed", className="text-center",style={"font-size":"23px","color":"#FFF"}),
  88.                                 html.P("867,868", style={"font-size":"40px","color":"#FF0000","font-weight":"bold"})
  89.                             ]
  90.                             , className="d-flex align-items-center justify-content-around ", style={"font-family": "Avenir Next W01" "Avenir Next W00" "Avenir Next" "Avenir" "Helvetica Neue" "sans-serif","background-color": "#232323","border": "1px solid gray","margin": "auto", "flex-direction": "column"}
  91.                             ), className="px-2"
  92.                         ),
  93.  
  94.                         dbc.Row(
  95.                             dbc.Col([
  96.                                 html.H4("Total Recovered", className="text-center",style={"font-size":"23px","color":"#FFF"}),
  97.                                 html.P("167,776", className="text-center", style={"color":"#15EB7D","font-size":"40px","font-weight":"bold"})
  98.                             ]
  99.                             , className="d-flex align-items-center justify-content-around", style={"font-family": "Avenir Next W01" "Avenir Next W00" "Avenir Next" "Avenir" "Helvetica Neue" "sans-serif","background-color": "#232323", "border": "1px solid gray","margin": "auto", "flex-direction": "column"}
  100.                             ),className="px-2"
  101.                         ),
  102.  
  103.                         dbc.Row(
  104.                             dbc.Col([
  105.                                 html.H4("Total Deaths", className="text-center"),
  106.                                 html.P("45,676", className="text-center", style={"font-size":"40px","font-weight":"bold"})]
  107.                                 , className="d-flex align-items-center justify-content-around", style={"font-family": "Avenir Next W01" "Avenir Next W00" "Avenir Next" "Avenir" "Helvetica Neue" "sans-serif","background-color": "#232323", "border": "1px solid gray","margin": "auto", "color": "#FFFFFF",
  108.                                        "flex-direction": "column"}
  109.                             ), className="px-2"
  110.                         ),
  111.  
  112.                         dbc.Row(
  113.                             dbc.Col([
  114.                                 html.H4("Active Days", className="text-center",style={"font-size":"23px","color":"#FFF"}),
  115.                                 html.P("124",className="text-center",style={"color":"#BDBDBD","font-size":"40px","font-weight":"bold"})
  116.                             ]
  117.                             , className="d-flex align-items-center justify-content-around", style={"font-family": "Avenir Next W01" "Avenir Next W00" "Avenir Next" "Avenir" "Helvetica Neue" "sans-serif","background-color": "#232323", "border": "1px solid gray","margin": "auto","color":"#FF00FF","flex-direction": "column" }
  118.                             ),className="px-2"
  119.                         ),
  120.                     ], className="d-flex justify-content-around", style={"flex-direction" : "column", "height": "80%"}),
  121.                 ],width=2.5),
  122.  
  123.                 dbc.Col([
  124.                         dbc.Row(html.Iframe(src="https://flo.uri.sh/visualisation/1746162/embed", width="90%", height="681px"), className="px-3"),
  125.                         dbc.Row(
  126.                             dbc.Col([
  127.                                 html.H4("Total texto", className="text-center"),
  128.                                 html.P("tecefefetr rtertretretret ertretertertgr  rtgregrggeger rgegegergegergergergrgegfefef efefefe ere rererrer", className="text-center")]
  129.                                 , className="d-flex align-items-center justify-content-around",
  130.                                   style={"font-family": "Avenir Next W01" "Avenir Next W00" "Avenir Next" "Avenir" "Helvetica Neue" "sans-serif",
  131.                                     "background-color": "#232323", "border": "1px solid gray", "margin": "auto",
  132.                                     "color": "#FF00FF",
  133.                                     "flex-direction": "column"}
  134.                             ), className="px-2"
  135.                         )
  136.                 ],style={"height":"100vh"}),
  137.  
  138.                 dbc.Col([
  139.                         dbc.Row(html.Iframe(src="https://flo.uri.sh/visualisation/1746162/embed", width="100%", height="400")),
  140.                         dbc.Row(html.Iframe(src="https://flo.uri.sh/visualisation/1746162/embed", width="100%", height="400"))
  141.                 ], width=3)
  142.             ],id="myDiv"),
  143.         ], className="flex-fluid flex-horizontal position-relative overflow-hidden",style={"display":"flex","height":"100vh","width":"100vw","background-color": "#000"})
  144.  
  145.         return col
  146.     elif tab == 'tab-2':
  147.         row = html.Div([
  148.  
  149.             html.Br(),
  150.              dbc.Row(
  151.                  [
  152.                      dbc.Col(html.Div(
  153.  
  154.                          html.Iframe(src="https://flo.uri.sh/visualisation/1746162/embed",
  155.                                      width="100%", height="400")
  156.                      )),
  157.                      dbc.Col(html.Div(
  158.                          html.Iframe(src="https://flo.uri.sh/visualisation/1746162/embed",
  159.                                      width="100%", height="400")
  160.                      )),
  161.                      dbc.Col(html.Div(
  162.                          html.Iframe(src="https://flo.uri.sh/visualisation/1746162/embed",
  163.                                      width="100%", height="400")
  164.                      )),
  165.                  ]
  166.              ),
  167.              dbc.Row(
  168.                  [
  169.                      dbc.Col(html.Div(
  170.  
  171.                          html.Iframe(src="https://flo.uri.sh/visualisation/1746162/embed",
  172.                                      width="100%", height="400")
  173.                      )),
  174.                      dbc.Col(html.Div(
  175.                          html.Iframe(src="https://flo.uri.sh/visualisation/1746162/embed",
  176.                                      width="100%", height="400")
  177.                      )),
  178.                      dbc.Col(html.Div(
  179.                          html.Iframe(src="https://flo.uri.sh/visualisation/1746162/embed",
  180.                                      width="100%", height="400")
  181.                      )),
  182.                  ]
  183.              ),
  184.              ],className="container-fluid"  )
  185.         return row
  186.     elif tab == 'tab-3':
  187.         return html.Div([
  188.             html.H3('Tab content 3')
  189.         ])
  190.     elif tab == 'tab-4':
  191.         return html.Div([
  192.             html.H3('Tab content 4')
  193.         ])
  194.     elif tab == 'tab-5':
  195.         return html.Div([
  196.             html.H3('Tab content 5')
  197.         ])
  198.  
  199. if __name__ == "__main__":
  200.     app.run_server(debug=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement