首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Python dash在实时更新‘TypeError:意外的关键字参数`n_intervals`中出现错误

Python dash在实时更新‘TypeError:意外的关键字参数`n_intervals`中出现错误
EN

Stack Overflow用户
提问于 2018-03-06 03:15:04
回答 1查看 2.1K关注 0票数 0

我运行了以下代码,得到了错误:

代码语言:javascript
复制
TypeError: Unexpected keyword argument `n_intervals`
Allowed arguments: disabled, fireEvent, id, interval, setProps

当我运行它的时候。我已经在我的python 2.7上安装了所有特定的库。

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

代码语言:javascript
复制
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毫秒更新一次?

EN

回答 1

Stack Overflow用户

发布于 2018-07-13 21:41:34

我怀疑这是Dash内部的版本更改,但我(和您一样)坚持使用较旧的版本。

旧版本(found here)的修复

代码语言:javascript
复制
#*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():
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49117851

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档