streamlit控件和控制2
目录button: #按钮
download_button: #文件下载
file_uploader: #文件上传
checkbox: #复选框
toggle: #切换框
radio: #单选按钮
selectbox: #下拉单选框
multiselect: #下拉多选框
slider: #滑动条
select_slider: #选择条
text_input: #文本输入框
text_area: #文本输入区域
number_input: #数字输入框,支持加减按钮
date_input: #日期选择框
time_input: #时间选择框
color_picker: #颜色选择器
st.radio
import streamlit as st
genre = st.radio(
"What's your favorite movie genre",
[":rainbow[Comedy]", "***Drama***", "Documentary :movie_camera:"],
index=None,
)
st.write("You selected:", genre)
import streamlit as st
# Store the initial value of widgets in session state
if "visibility" not in st.session_state:
st.session_state.visibility = "hidden"
st.session_state.disabled = False
st.session_state.horizontal = False
col1, col2 = st.columns(2)
with col1:
st.checkbox("Disable radio widget", key="disabled") # 是否显示
st.checkbox("Orient radio options horizontally", key="horizontal") # 选择是否水平
with col2:
st.radio(
"Set label visibility
标签:控件,None,控制,value,label,import,streamlit,st
From: https://www.cnblogs.com/tian777/p/17802701.html