We want to serve additional menus sequentially based on the selection from the options provided.
I’m using streamlit-option-menu. because selectbox can’t maintain the dropdown state, and radio can’t remove the button in front of it.
button to sequentially remove the child option_menu created by the button, but del doesn’t work.
from streamlit_option_menu import option_menu
def create_option_menu(key, header, data, on_change_callback):
selected_category = option_menu(None, [header] + list(data),
on_change=on_change_callback,
key=key
)
return selected_category
create option_menu and save to session
st.session_state[“selected_category”] = create_option_menu(‘category’, cfg.OPTION_CATEGORY, categories, on_change)
not change…
if st.button(“home”, key=‘btn_home’):
del st.session_state[“selected_type”]
st.rerun()`