Python dash在实时更新'TypeError:Unexpected关键字参数`n_intervals`中给出错误

问题描述 投票:0回答:1

我运行下面的代码,我得到错误:

TypeError: Unexpected keyword argument `n_intervals`
Allowed arguments: disabled, fireEvent, id, interval, setProps

当我跑它。我在python 2.7上安装了所有特定的库。

请找到我正在运行的代码:

app.layout = html.Div
    [
        dcc.Tabs(
            tabs=[
                {'label': seclist.keys()[i],'value': i} for i in range(0, 5)
            ],
            value=0,
            id='tabs'
        ),

        html.Div([
            html.H4('TERRA Satellite Live Feed'),
            html.Div(id='live-update-text'),
            dcc.Graph(id='live-update-graph'),
            dcc.Interval(
                id='interval-component',
                interval=1*1000, # in milliseconds
                n_intervals=0
            )
        ]), 

        html.Div(id='tab-output')
    ],

    style={
        'width': '80%',
        'fontFamily': 'Sans-Serif',
        'margin-left': 'auto',
        'margin-right': 'auto'
    })
print 'HI'


@app.callback(Output('tabs','value'), [Input('interval-component','n_intervals')])
def updateData(n):
    print 'yo man'
    extractData(df,axis_points)

我的另一个问题是,我看到大多数实时示例使用单个图或子图,但是是否可以使用不同的选项卡,每个选项卡每100毫秒更新一次?

python visualization plotly-dash
1个回答
0
投票

我怀疑这是Dash中的版本更改,但我(像你一样)被困在旧版本上。

与旧版本(found here)修复:

#*In Layout*
            dcc.Interval(
                id='interval-component',
                interval=1*1000, # in milliseconds
            )

#*Callback*
@app.callback(
    output=Output(component_id='tabs', component_property='value'),
    events=[Event('interval-component', 'interval')]
)
def updateData():
© www.soinside.com 2019 - 2024. All rights reserved.