[Python] unable to recognize my inputs in python plotty - dash

Discussão em 'Python' iniciado por Stack, Outubro 5, 2024.

  1. Stack

    Stack Membro Participativo

    dash_app = dash.Dash(__name__)
    dash_app.layout = html.Div([
    html.Div([
    html.P("Range: ", style={'margin-right': '10px'}),
    dcc.Input(id='user-min-strike', type='number', value=5600, style={'margin-right': '10px'}),
    dcc.Input(id='user-max-strike', type='number', value=5800),
    dcc.Input(id='user-minutes', type='number', value=100),
    ], style={'display': 'flex', 'align-items': 'center', 'margin-bottom': '20px'}),
    dcc.Graph(id='live-update-graph', config={'displayModeBar': False}),
    dcc.Interval(
    id='interval-component',
    interval=2*1000, # Update every 2 seconds
    n_intervals=0
    )
    ])


    my callback:

    @dash_app.callback(
    Output('live-update-graph', 'figure'),
    [Input('interval-component', 'n_intervals'),
    Input('user-min-strike', 'value'),
    Input('user-max-strike', 'value'),
    Input('user-minutes', 'value')
    ])


    i get this error:

    lambda ind: inputs_state[ind], inputs_state_indices
    IndexError: list index out of range


    i got into dash code and print the number of inputs right after they get them from the body, it only includes one, the interval even though they appear in the webpage

    print the body from dash code:
    {'output': 'live-update-graph.figure', 'outputs': {'id': 'live-update-graph', 'property': 'figure'}, 'inputs': [{'id': 'interval-component', 'property': 'n_intervals', 'value': 148}], 'changedPropIds': ['interval-component.n_intervals'], 'parsedChangedPropsIds': ['interval-component.n_intervals']}

    Continue reading...

Compartilhe esta Página