Quantcast
Channel: 🎛️ Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271

dcc.Interval duplicate runs

$
0
0

@kav wrote:

It looks like the the interval input is being triggered twice every time.
I would expect it to only run once.
Also why is the first value of n_intervals non-zero?

image

import dash
import dash_core_components as dcc
import dash_html_components as html
import datetime as dt

app = dash.Dash()

app.layout = html.Div([
    dcc.Interval(id='my-interval', interval=5*1000, n_intervals=0),
    html.Div(id='display'),
])


@app.callback(
    output=dash.dependencies.Output('display', 'children'),
    inputs=[dash.dependencies.Input('my-interval', 'n_intervals')])
def display_updae(n):
    print (f'n_intervals: {n} ... {str(dt.datetime.now())}')
    return ""


if __name__ == '__main__':
    app.run_server(debug=True)

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6271

Trending Articles