Python Dash体验

# -*- coding: utf-8 -*-

"""
@author: 赫凯
@software: PyCharm
@file: main.py
@time: 2023/4/23 16:01
"""

from dash import Dash, html, dcc
from dash.dependencies import Input, Output, State
import plotly.express as px

app = Dash(__name__)


# 初始化界面
def init_ui(app):
    app.layout = html.Div(children=[
        html.H1(children='你好,欢迎使用'),

        html.Div(children='''
            选择文件
        '''),
        html.Div(children=[
            dcc.Input(id="file_select", type="file", placeholder="Debounce False"),
        ]),
        html.Br(),
        html.Div(id='my-output'),
        html.Button(id='submit-button-state', n_clicks=0, children='Submit'),
        dcc.Graph()
    ])

    @app.callback(
        Output(component_id='my-output', component_property='children'),
        Input(component_id='file_select', component_property='value')
    )
    def update_output_div(input_value):
        return f'路径为: {
      
      input_value}'


if __name__ == '__main__':
    init_ui(app)
    app.run_server()

猜你喜欢

转载自blog.csdn.net/u010095372/article/details/131539474