Example #1
0
        ], justify='center', className='m-1'),
        dbc.Row([
            html.Img(src="assets/images/main_image.png", width="60%")
        ], justify='center', className='m-1'),

        html.Br(),

        html.Table([

            html.Tr(
                dcc.Link('Start', href='main_app', className='btn btn-primary btn-lg', style={'width': '100%'}),
            ),
         
        ], style={'margin-left':'auto', 'margin-right':'auto', 'border-collapse':'separate', 'border-spacing':'17px'}),
    ])

])

@app.callback(Output('page-content', 'children'),
              [Input('url', 'pathname')])
def display_page(pathname):
    if pathname == '/':
        return main_menu
    elif pathname == '/main_app':
        return main_app.layout
    else:
        return '404'

if __name__ == '__main__':
    app.run_server(debug=False)
Example #2
0
#            GLOBAL LAYOUT           #
# ---------------------------------- #

app.layout = html.Div([
    dcc.Location(
        id='url',
        hash='home',
        refresh=False,  # Don't refresh the page when updating location
    ),
    navbar,
    html.Div(id='page-content')
])


@app.callback(Output('page-content', 'children'), [Input('url', 'pathname')])
def display_page(pathname):
    if pathname == '/research':
        return research.layout
    elif pathname == '/backtest':
        return backtest.layout
    # elif pathname == '/economy':
    #     return economy.layout
    # elif pathname == '/contact':
    #     return contact.layout
    else:
        return research.layout


if __name__ == '__main__':
    app.run_server(port=8888, debug=True)
Example #3
0
import dash_table

from pages import files_page
from pages import db_page
from pages import Home_Page
import requests

from main import app

app.layout = html.Div([
    dcc.Location(id='url', refresh=False),
    html.Div(id='page-content'),
])

# Page File_page callback


# Index Page callback
@app.callback(Output('page-content', 'children'), [Input('url', 'pathname')])
def display_page(pathname):
    if pathname == '/files_page':
        return files_page.files_page_layout
    elif pathname == '/db_page':
        return db_page.db_page_layout
    else:
        return Home_Page.HomePage_layout


if __name__ == '__main__':
    app.run_server()
Example #4
0
# corresponding nav link to true, allowing users to tell see page they are on
@app.callback(
    [Output(f"page-{i}-link", "active") for i in range(1, 4)],
    [Input("url", "pathname")],
)
def toggle_active_links(pathname):
    if pathname == "/":
        # Treat page 1 as the homepage / index
        return True, False, False
    return [pathname == f"/page-{i}" for i in range(1, 4)]


@app.callback(Output("page-content", "children"), [Input("url", "pathname")])
def render_page_content(pathname):
    if pathname in ["/", "/page-1"]:
        return html.Div(['Personal Studies of Dash App'])
    elif pathname == "/page-2":
        return stockapp.layout
    elif pathname == "/page-3":
        return want_a_gear.layout
    # If the user tries to reach a different page, return a 404 message
    return dbc.Jumbotron([
        html.H1("404: Not found", className="text-danger"),
        html.Hr(),
        html.P(f"The pathname {pathname} was not recognised..."),
    ])


if __name__ == '__main__':
    app.run_server(debug=True)
Example #5
0
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output

from main import app
from viz_apps import app1, app2

app.layout = html.Div(
    [dcc.Location(id='url', refresh=False),
     html.Div(id='page-content')])


@app.callback(Output('page-content', 'children'), [Input('url', 'pathname')])
def display_page(pathname):
    if pathname == '/viz/viz1':
        return app1.layout
    elif pathname == '/viz/viz2':
        return app2.layout
    else:
        return "404"


if __name__ == '__main__':
    app.run_server(host="0.0.0.0", debug=True)