Spaces:
Sleeping
Sleeping
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("๋ฉ๋ด๋ฅผ ์ ํํด์ฃผ์ธ์.")
|