My code:
# The dictionary is actually going to be dynamic
zoon = {
"cat": ['缅因', '金渐层', '三花猫', '美短'],
"dog": ['柴犬', '二哈', '萨摩耶', '金毛']
}
data_tabs = list(zoon.keys())
tabs = st.tabs(data_tabs)
for i in range(len(data_tabs)):
with tabs[i]:
curr_zoon = st.radio("请在下面列表中选择您要展示类型", zoon[data_tabs[i]], index=None)
if curr_zoon:
# Assuming that the data is fixed, the actual project needs to get the data from the database
ss.all_info_list = {'questions': ['猫经常叫都有哪些原因?', '猫咪为何会突然跑酷', '猫咪拉肚子应该吃什么药']}
if ss.all_info_list is not None:
with st.container(border=True): # This is also currently fixed...
st.text_area('喵喵','猫是一种优雅、神秘且独立的动物。它们拥有柔软的皮毛,灵动的眼神,以及令人着迷的独特个性。猫是出色的猎手,擅长潜伏和突袭,但它们的温柔和亲近也使它们成为人类的忠实伙伴。无论是蜷缩在温暖的角落里打盹,还是在窗边凝视着窗外的世界,猫总是能以它们独特的方式给人们的生活带来乐趣和慰藉。它们不仅是宠物,更是家庭的一员,带给人们无尽的欢乐和温暖的陪伴。', disabled=True)
st.selectbox('问题', ss.all_info_list['questions'], index=None)
My question:
How to clear the radio status in the previous tab and clear the content below when switching tabs.
- When switching from dog to cat, you need to clear the contents of the red box and reset the status of the radio
- When you switch from cat to dog, the contents of cat, which are in the red box, should not appear