Plotly-Dash:3个回调,相同的输入列表-调用2个,不调用1个

时间:2019-04-21 22:00:12

标签: python plotly-dash

3个具有相同输入列表的回调,其中2个被调用,但不是1。在第三个通知的调试器中,执行直接从输入列表跳出函数。任何暗示欢迎...

@app.callback(
    dash.dependencies.Output('firstcallback', 'children'),
    [dash.dependencies.Input('firstdropdown', 'value'),
     dash.dependencies.Input('seconddropdown', 'value')])
def firstgoodcallback(first, second):
    print("firstgoodcallback") #prints ok
    return u'{} is a reference to {}'.format(first, second)

@app.callback(
    dash.dependencies.Output('secondcallback', 'children'),
    [dash.dependencies.Input('firstdropdown', 'value'),
     dash.dependencies.Input('seconddropdown', 'value')])
def secondgoodcallback(first, second):
    print("secondgoodcallback") #prints ok
    return u'{} is a second reference to {}'.format(first, second)

@app.callback(
    dash.dependencies.Output('thirdcallback', 'children'),
    [dash.dependencies.Input('firstdropdown', 'value'),
     dash.dependencies.Input('seconddropdown', 'value')])
def set_display_children(first, second):
    print("helloWorld") #doesn't get this far    
    return u'{} is a third reference to {}'.format(first, second)

'firstdropdown''seconddropdown'都在启动时用默认值初始化,并且所有回调都在具有name==main保护的同一模块中。谢谢

0 个答案:

没有答案