Maryam Ilka commited on
Commit
d694f06
·
verified ·
1 Parent(s): 0f28fca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -29
app.py CHANGED
@@ -1,9 +1,6 @@
1
  import streamlit as st
2
  import folium
3
  from streamlit_folium import folium_static
4
- from streamlit.components.v1 import html
5
- import custom_button
6
- from streamlit.runtime.scriptrunner import RerunData, RerunException
7
  from datetime import datetime
8
  import gspread
9
  from google.oauth2.service_account import Credentials
@@ -603,23 +600,13 @@ def attention_check1():
603
  key="att1_radio"
604
  )
605
 
606
- # استفاده از کامپوننت اختصاصی
607
- custom_button("ادامه", key="continue_btn")
608
-
609
- # بررسی کلیک
610
- if st.session_state.get("continue_btn_clicked"):
611
- if not answer:
612
- st.warning("لطفاً یک گزینه را انتخاب کنید")
613
  else:
614
- st.session_state.attention_check1 = answer
615
- # تغییر صفحه به صورت دستی
616
- def update_page():
617
- pages = get_pages("")
618
- pages["random_likert_questions"].is_active = True
619
- pages["current_page"].is_active = False
620
- raise RerunException(RerunData())
621
-
622
- update_page()
623
 
624
 
625
  def attention_check2():
@@ -914,14 +901,4 @@ def main():
914
  pages[st.session_state.current_page]()
915
 
916
  if __name__ == "__main__":
917
- # دریافت پیام از دکمه
918
- if "continue_btn_clicked" not in st.session_state:
919
- st.session_state.continue_btn_clicked = False
920
-
921
- # دریافت پیام از iframe
922
- from streamlit.web.server.websocket_headers import _get_websocket_headers
923
- headers = _get_websocket_headers()
924
- if headers and headers.get("Referer"):
925
- if "continue_btn_clicked" in headers.get("Referer"):
926
- st.session_state.continue_btn_clicked = True
927
  main()
 
1
  import streamlit as st
2
  import folium
3
  from streamlit_folium import folium_static
 
 
 
4
  from datetime import datetime
5
  import gspread
6
  from google.oauth2.service_account import Credentials
 
600
  key="att1_radio"
601
  )
602
 
603
+ if st.button("ادامه", key="att1_btn"):
604
+ if answer:
605
+ st.session_state.attention_check1 = answer # ذخیره پاسخ در session_state
606
+ st.session_state.current_page = "random_likert_questions"
607
+ st.rerun()
 
 
608
  else:
609
+ st.warning("لطفاً یک گزینه را انتخاب کنید")
 
 
 
 
 
 
 
 
610
 
611
 
612
  def attention_check2():
 
901
  pages[st.session_state.current_page]()
902
 
903
  if __name__ == "__main__":
 
 
 
 
 
 
 
 
 
 
904
  main()