【问题标题】:How can ı use st.columns with st.tabs (Streamlit)我如何将 st.columns 与 st.tabs 一起使用(Streamlit)
【发布时间】:2022-08-24 00:14:57
【问题描述】:

我想在 streamlit 中一起处理选项卡和列

这就是我想要做的

with st.tabs(\"tab1\"):
    with st.columns(\"col1\"):
        st.selectbox(\"City\", [\"City1\", \"City2\"-])
    with st.columns(\"col2\"):
        st.selectbox(\"District\", [\"District1\", \"District2\"])

with st.tabs(\"tabs2\"):
    with st.columns(\"another_col1\"):
         st.selectbox(\"Another City\", [\"Another_City1\", \"Another_City2\"])
    with st.columns(\"another_col2\"):
         st.selectbox(\"Another District\", [\"Another_District1\", \"Another_District2\"])

当我分别打开每个选项卡时,我想在每个选项卡中看到不同的选择框。我怎样才能做到这一点 ?

    标签: python streamlit


    【解决方案1】:
    tab1, tab2 = st.tabs(["tab1", "tab2"])
    col1, col2 = st.columns(2)
    
    with tab1:
        with col1:
            st.selectbox("City", ["City1", "City2"])
        with col2:
            st.selectbox("District", ["District1", "District2"])
    
    with tab2:
        with col1:
            st.selectbox("Another City", ["Another_City1", "Another_City2"])
        with col2:
            st.selectbox("Another District", ["Another_District1", "Another_District2"])
    

    【讨论】:

      猜你喜欢
      • 2021-04-12
      • 2022-12-09
      • 2021-06-06
      • 1970-01-01
      • 2020-08-17
      • 2013-05-17
      • 1970-01-01
      • 2013-08-05
      • 1970-01-01
      相关资源
      最近更新 更多