自定义 Streamlit 中的侧边栏(页面)以具有部分

问题描述 投票:0回答:1

我正在开发一个简单的多页 Streamlit 应用程序,它允许对某些数据执行 CRUD 操作。我知道创建一个

pages
目录将允许我在我的应用程序中拥有多个页面,这就是我所做的,如下所示,

enter image description here

我的项目结构如下所示,

/Home.py
/pages/Add_Pikcups.py
/pages/View_Pickups.py

现在,我想在我的应用程序中有多个部分。例如,这些是“Pickups”部分下的页面,然后我还希望有一个“Drops”部分等等。

有什么方法可以自定义侧边栏以将页面显示为多个部分吗?

所以,我想要类似的东西,

皮卡

  • 添加接送
  • 查看接送

  • 添加水滴
  • 查看掉落物

不是要点,但我希望这个想法很清楚。

python python-3.x streamlit
1个回答
0
投票
pages/drops.py

import streamlit as st


st.sidebar.radio('drops sub-menu', options=['add drops', 'view drops'])
st.sidebar.checkbox('special')
pages/pickups.py

import streamlit as st


st.sidebar.selectbox('Person incharge', options=['john', 'peter'], index=0)
st.sidebar.selectbox('location', options=['manila', 'tokyo'], index=1)

减少输出

enter image description here

拾音器输出

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.