Skip to content

Instantly share code, notes, and snippets.

@danlester
Created July 6, 2020 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danlester/69c4d7e29fd4d06aaea1e2bf061bf575 to your computer and use it in GitHub Desktop.
Save danlester/69c4d7e29fd4d06aaea1e2bf061bf575 to your computer and use it in GitHub Desktop.
import dash
from dash.dependencies import Input, Output
import dash_html_components as html
from datetime import datetime
app = dash.Dash(__name__)
start_time = datetime.now()
app.layout = html.Div(children=[
html.H1(children='Start time {}'.format(start_time)),
html.Div(children='', id='outputdiv'),
html.Button('Increment', id='button', n_clicks=0)
])
@app.callback(Output('outputdiv', 'children'), [Input('button', 'n_clicks')])
def add_sliders(n_clicks):
return 'Clicked! Start Time {}; Count {}'.format(start_time, n_clicks)
if __name__ == '__main__':
app.run_server(debug=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment