How to insert elements out of order?
你可以使用st.empty方法作为占位符,在你的应用程序中“保存”一个位置,以便稍后使用。
st.text('This will appear first')
# Appends some text to the app.
my_slot1 = st.empty()
# Appends an empty slot to the app. We'll use this later.
my_slot2 = st.empty()
# Appends another empty slot.
st.text('This will appear last')
# Appends some more text to the app.
my_slot1.text('This will appear second')
# Replaces the first empty slot with a text string.
my_slot2.line_chart(np.random.randn(20, 2))
# Replaces the second empty slot with a chart.
还有问题吗?
我们的 论坛 充满了有用的信息和Streamlit专家。