-
Intervalplotly dash 2022. 6. 14. 21:05
문제
2초, 4초마다 1씩 숫자를 증가시키도록 해 보자.
코드
from dash import Dash, html, dcc, Input, Output app = Dash(__name__) app.layout = html.Div([ html.H1('Interval Test'), html.Div(id='two-count'), html.Div(id='four-count'), dcc.Interval(id='two-interval', interval=1000 * 2, n_intervals=0), dcc.Interval(id='four-interval', interval=1000 * 4, n_intervals=0) ]) @app.callback( Output('two-count', 'children'), Output('four-count', 'children'), Input('two-interval', 'n_intervals'), Input('four-interval', 'n_intervals') ) def apply_slider(n_two, n_four): return html.Div(f"TWO Count: {n_two}"), html.Div(f"FOUR Count: {n_four}") if __name__ == '__main__': app.run_server(debug=True)
'plotly dash' 카테고리의 다른 글
admin (multi-page) 화면 개발 (0) 2023.07.15 Advanced Callback (0) 2023.06.15 Tab (0) 2022.06.14 RangeSlider (0) 2022.06.14 Flask route 추가하기 (0) 2022.05.31