File size: 815 Bytes
cead143
79d2b6a
6e8c858
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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("๋ฉ”๋‰ด๋ฅผ ์„ ํƒํ•ด์ฃผ์„ธ์š”.")