2024-09-25 08:28:46 发布
网友
已经使用plotly python绘制了多个绘图,我想做一个相当简单的任务:在HTML输出页面中显示变量的值
想象一下,下面的dashboard顶部有一个数字(大字体)显示总成本。任何帮助都将不胜感激
尽管向我们展示代码会更有帮助,但解决问题的一个简单方法是在布局中使用HTML.div并使用id设置它,然后使用相应的id创建一个回调,该id作为返回变量值的输出
例如:
import dash import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output app = dash.Dash(__name__) app.layout = html.Div([ html.Div(id='my-output'), html.Div(id='my-output'), ]) x = "hi" @app.callback( Output(component_id='my-output', component_property='children'), Input(component_id='my-input', component_property='children') ) def update_output_div(input): return x if __name__ == '__main__': app.run_server(debug=True)
尽管向我们展示代码会更有帮助,但解决问题的一个简单方法是在布局中使用HTML.div并使用id设置它,然后使用相应的id创建一个回调,该id作为返回变量值的输出
例如:
相关问题 更多 >
编程相关推荐