插入一個多元素容器。
將一個不可見的容器插入到您的應用程序中,該容器可用於容納多個元素。例如,這允許您將多個元素亂序插入到您的應用程序中。
要將元素添加到返回的容器中,您可以使用"with" 表示法(首選)或直接在返回的對象上調用方法。請參閱下麵的示例。
函數簽名
st.container()
例子
使用 "with" 表示法插入元素:
with st.container():
st.write("This is inside the container")
# You can call any Streamlit command, including custom components:
st.bar_chart(np.random.randn(50, 3))
st.write("This is outside the container")
亂序插入元素:
container = st.container()
container.write("This is inside the container")
st.write("This is outside the container")
# Now insert some more in the container
container.write("This is inside too")
相關用法
- Python Streamlit st.code用法及代碼示例
- Python Streamlit st.color_picker用法及代碼示例
- Python Streamlit st.columns用法及代碼示例
- Python Streamlit st.caption用法及代碼示例
- Python Streamlit st.cache用法及代碼示例
- Python Streamlit st.camera_input用法及代碼示例
- Python Streamlit st.checkbox用法及代碼示例
- Python Streamlit st.experimental_singleton.clear用法及代碼示例
- Python Streamlit st.bokeh_chart用法及代碼示例
- Python Streamlit st.text_input用法及代碼示例
- Python Streamlit st.area_chart用法及代碼示例
- Python Streamlit st.title用法及代碼示例
- Python Streamlit st.experimental_singleton用法及代碼示例
- Python Streamlit st.empty用法及代碼示例
- Python Streamlit st.error用法及代碼示例
- Python Streamlit st.video用法及代碼示例
- Python Streamlit st.vega_lite_chart用法及代碼示例
- Python Streamlit st.slider用法及代碼示例
- Python Streamlit st.header用法及代碼示例
- Python Streamlit st.form_submit_button用法及代碼示例
- Python Streamlit st.form用法及代碼示例
- Python Streamlit st.plotly_chart用法及代碼示例
- Python Streamlit st.bar_chart用法及代碼示例
- Python Streamlit st.experimental_memo.clear用法及代碼示例
- Python Streamlit st.warning用法及代碼示例
注:本文由純淨天空篩選整理自streamlit.io大神的英文原創作品 st.container。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。