首页 > 解决方案 > 破折号:如何扩展组件以填充剩余的水平和垂直空间

问题描述

我有一些 div、按钮和下拉菜单,我想填充剩余的可用空间?我怎么能做这样的事情?

一个例子是:

import dash
import dash_bootstrap_components as dbc

app = dash.Dash(external_stylesheets=[dbc.themes.CERULEAN])

app.layout = \
    dbc.Container \
            ([
            dbc.Row([
                dbc.Col
                    ([
                    dbc.Row([dbc.Button("Graph here", style={"width": "100%"})]), # make this fill the available height
                    dbc.Row([dbc.Button("Load file",  style={"width": "50%"}), dbc.Button("Load a different file") # make this button fill available width]),
                ], width=9),
                dbc.Col
                    ([
                    dbc.Row([dbc.Button("Choose data",  style={"width": "100%"})]),
                    dbc.Row([dbc.Button("Change graph", style={"width": "100%"})]), # make this fill available height
                ], width=3)
            ])
        ], fluid=True)

if __name__ == "__main__":
    app.run_server(debug=False, port=8050)

标签: pythonplotly-dash

解决方案


推荐阅读