Python plotly dash - 按钮到 link 到网页
Python plotly dash - button to link to webpage
我正在使用 python 破折号,我希望在我的 table 下方有一个按钮,单击该按钮会将用户带到特定网页。我非常 - 非常 - 刚开始使用破折号,所以我什至不确定这个功能是否存在。我确实专门针对 python dash 搜索了这个主题,结果空手而归。感谢您提供任何帮助,谢谢!
use this for button example and to learn more please use this
import dash
import dash_html_components as html
import dash_core_components as dcc
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div([
html.Div(dcc.Input(id='input-box', type='text')),
html.Button('Submit', id='button'),
html.Div(id='output-container-button',
children='Enter a value and press submit')
])
@app.callback(
dash.dependencies.Output('output-container-button', 'children'),
[dash.dependencies.Input('button', 'n_clicks')],
[dash.dependencies.State('input-box', 'value')])
def update_output(n_clicks, value):
return 'The input value was "{}" and the button has been clicked {} times'.format(
value,
n_clicks
)
if __name__ == '__main__':
app.run_server(debug=True)
我正在使用 python 破折号,我希望在我的 table 下方有一个按钮,单击该按钮会将用户带到特定网页。我非常 - 非常 - 刚开始使用破折号,所以我什至不确定这个功能是否存在。我确实专门针对 python dash 搜索了这个主题,结果空手而归。感谢您提供任何帮助,谢谢!
use this for button example and to learn more please use this
import dash
import dash_html_components as html
import dash_core_components as dcc
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div([
html.Div(dcc.Input(id='input-box', type='text')),
html.Button('Submit', id='button'),
html.Div(id='output-container-button',
children='Enter a value and press submit')
])
@app.callback(
dash.dependencies.Output('output-container-button', 'children'),
[dash.dependencies.Input('button', 'n_clicks')],
[dash.dependencies.State('input-box', 'value')])
def update_output(n_clicks, value):
return 'The input value was "{}" and the button has been clicked {} times'.format(
value,
n_clicks
)
if __name__ == '__main__':
app.run_server(debug=True)