【问题标题】:How can i arrange button location on Dash Plotly?如何在 Dash Plotly 上安排按钮位置?
【发布时间】:2021-12-09 08:11:36
【问题描述】:

我正在使用 Dash by Plotly 制作仪表板。它对我来说真的很快而且很有用。但我找不到如何安排例如按钮的位置。例如,我希望按钮为 x=5,y=150。但我找不到有关文档的解决方案。此外,我检查了 github 中的 dash 核心组件,但找不到 x 坐标或位置等位置。我是否需要以某种方式添加 react.js 代码?提前致谢。

【问题讨论】:

    标签: python plotly-dash


    【解决方案1】:

    我假设您并不是要以这种方式创建整个布局,而只是想在所需的 x 和 y 处放置一个特定的按钮。

    可以使用dash-mantine-components自带的Affix组件。

    PS:我是这个库的作者。

    import dash_mantine_components as dmc
    from dash import Dash, html
    
    app = Dash(__name__)
    
    app.layout = html.Div(
        [
            dmc.Affix(
                dmc.Button("I'm in an affix component!"), position={"top": 5, "left": 150}
            )
        ]
    )
    
    
    if __name__ == "__main__":
        app.run_server(debug=True)
    

    Output

    【讨论】:

    • 非常感谢。这正是我想要的:)
    猜你喜欢
    • 2021-05-22
    • 1970-01-01
    • 2020-11-21
    • 2020-09-24
    • 2021-05-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-22
    • 2020-06-13
    相关资源
    最近更新 更多