这个
columns
需要创建容器
在内部
这个
form
的上下文管理器:
import streamlit as st
st.header("Selectbox side by side in form")
with st.form("Form1"):
col1, col2 = st.columns(2) # << here
col1.selectbox("Select track", ["track 1", "track 2"])
col2.selectbox("Select track 2", ["track 1", "track 2"])
st.slider("Select your race finish position", 1, 12, key="number")
st.form_submit_button("Submit your race")