Rathapoom commited on
Commit
dd1cc59
·
verified ·
1 Parent(s): d85f1b5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -1207,20 +1207,23 @@ def show_theme_selection():
1207
  available_themes = get_available_themes(st.session_state.level)
1208
 
1209
  # แบ่งธีมเป็น rows
1210
- for i in range(0, len(available_themes), themes_per_row):
1211
  row_themes = available_themes[i:i + themes_per_row]
1212
  cols = st.columns(themes_per_row)
1213
 
1214
  # แสดงแต่ละธีมใน column
1215
- for col, theme in zip(cols, row_themes):
1216
  with col:
 
 
 
1217
  # สร้าง container สำหรับแต่ละธีม
1218
  theme_container = st.container()
1219
  with theme_container:
1220
  # ใช้ button แทน div
1221
  if st.button(
1222
  f"{theme['icon']} {theme['name_th']}",
1223
- key=f"theme_button_{theme['id']}",
1224
  help=theme['description_th'],
1225
  use_container_width=True,
1226
  ):
@@ -1245,6 +1248,9 @@ def show_theme_selection():
1245
  unsafe_allow_html=True
1246
  )
1247
 
 
 
 
1248
 
1249
  # Add theme-specific CSS
1250
  def add_theme_css():
 
1207
  available_themes = get_available_themes(st.session_state.level)
1208
 
1209
  # แบ่งธีมเป็น rows
1210
+ for row_idx, i in enumerate(range(0, len(available_themes), themes_per_row)):
1211
  row_themes = available_themes[i:i + themes_per_row]
1212
  cols = st.columns(themes_per_row)
1213
 
1214
  # แสดงแต่ละธีมใน column
1215
+ for col_idx, (col, theme) in enumerate(zip(cols, row_themes)):
1216
  with col:
1217
+ # สร้าง unique key โดยใช้ row_idx และ col_idx
1218
+ unique_key = f"theme_button_{theme['id']}_{row_idx}_{col_idx}"
1219
+
1220
  # สร้าง container สำหรับแต่ละธีม
1221
  theme_container = st.container()
1222
  with theme_container:
1223
  # ใช้ button แทน div
1224
  if st.button(
1225
  f"{theme['icon']} {theme['name_th']}",
1226
+ key=unique_key,
1227
  help=theme['description_th'],
1228
  use_container_width=True,
1229
  ):
 
1248
  unsafe_allow_html=True
1249
  )
1250
 
1251
+ # เพิ่มช่องว่างด้านล่าง
1252
+ st.markdown("<br>", unsafe_allow_html=True)
1253
+
1254
 
1255
  # Add theme-specific CSS
1256
  def add_theme_css():