Spaces:
Sleeping
Sleeping
import streamlit as st | |
# μ¬μ΄λλ° νμ΄ν | |
st.sidebar.title("μ μ΄μ λ©λ΄") | |
# λ©λ΄ νλͺ©κ³Ό νμ νλͺ© μ μ | |
menus = { | |
"A": ["A-1", "A-2", "A-3"], | |
"B": ["B-1", "B-2", "B-3"], | |
"C": ["C-1", "C-2", "C-3"], | |
"D": ["D-1", "D-2", "D-3"], | |
"E": ["E-1", "E-2", "E-3"], | |
} | |
# μ νλ λ©λ΄λͺ μ μ μ₯ν λ³μ | |
selected_menu = None | |
# κ° λ©λ΄μ λν΄ μ¬μ΄λλ°μ μ μ΄μ λ©λ΄ μμ± | |
for menu in menus: | |
with st.sidebar.expander(menu): | |
for sub_menu in menus[menu]: | |
if st.button(sub_menu, key=sub_menu): # κ³ μ ν keyλ₯Ό μ 곡νμ¬ κ° λ²νΌμ κ΅¬λ³ | |
selected_menu = sub_menu | |
# μ νλ λ©λ΄λͺ μΆλ ₯ | |
if selected_menu: | |
st.write(f"μ νλ λ©λ΄: {selected_menu}") | |
else: | |
st.write("λ©λ΄λ₯Ό μ νν΄μ£ΌμΈμ.") | |