GSMEthesis commited on
Commit
6fb175f
·
verified ·
1 Parent(s): 2404f3c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -11
app.py CHANGED
@@ -739,7 +739,7 @@ h3 {
739
 
740
  # ========== توابع اصلی ==========
741
  def enhanced_likert_scale(question_data):
742
- """لیکرت اسکیل با جهت‌دهی صحیح راست به چپ"""
743
  question = question_data["question"]
744
  key = question_data["key"]
745
  scale = question_data["scale"]
@@ -752,12 +752,9 @@ def enhanced_likert_scale(question_data):
752
  st.markdown(f"<div style='text-align:center; font-weight:bold; margin-bottom:15px;'>{question}</div>",
753
  unsafe_allow_html=True)
754
 
755
- # ایجاد خط و نقاط با جهت‌دهی RTL
756
  scale_html = f"""
757
  <style>
758
- .likert-container {{
759
- direction: rtl;
760
- }}
761
  .likert-line {{
762
  width: 80%;
763
  height: 2px;
@@ -765,6 +762,7 @@ def enhanced_likert_scale(question_data):
765
  margin: 0 auto;
766
  position: relative;
767
  display: flex;
 
768
  }}
769
  .likert-dot {{
770
  width: 20px;
@@ -778,7 +776,6 @@ def enhanced_likert_scale(question_data):
778
  display: flex;
779
  align-items: center;
780
  justify-content: center;
781
- margin: 0 -1px;
782
  }}
783
  .likert-dot.selected {{
784
  background: #6a0dad;
@@ -795,7 +792,6 @@ def enhanced_likert_scale(question_data):
795
  margin-top: 10px;
796
  color: #6a0dad;
797
  font-weight: bold;
798
- direction: rtl;
799
  }}
800
  @media (max-width: 768px) {{
801
  .likert-line {{
@@ -815,9 +811,9 @@ def enhanced_likert_scale(question_data):
815
  <div class='likert-line'>
816
  """
817
 
818
- # اضافه کردن نقاط به صورت راست به چپ
819
  for i in range(scale):
820
- value = i + 1 # تغییر اینجا از scale-i به i+1 برای جهت‌دهی صحیح
821
  is_selected = st.session_state.get(key) == value
822
  scale_html += f"<div class='likert-dot {'selected' if is_selected else ''}' onclick='setLikertValue({value})'></div>"
823
 
@@ -844,11 +840,11 @@ def enhanced_likert_scale(question_data):
844
  </script>
845
  """, height=80)
846
 
847
- # دکمه‌های واقعی (مخفی) با جهت‌دهی صحیح
848
  btn_cols = st.columns(scale)
849
  for i in range(scale):
850
  with btn_cols[i]:
851
- value = i + 1 # تغییر اینجا برای تطابق با جهت‌دهی RTL
852
  if st.button(
853
  str(value),
854
  key=f"{key}_btn_{value}",
 
739
 
740
  # ========== توابع اصلی ==========
741
  def enhanced_likert_scale(question_data):
742
+ """لیکرت اسکیل با خط و نقاط - کاملاً واکنش‌گرا"""
743
  question = question_data["question"]
744
  key = question_data["key"]
745
  scale = question_data["scale"]
 
752
  st.markdown(f"<div style='text-align:center; font-weight:bold; margin-bottom:15px;'>{question}</div>",
753
  unsafe_allow_html=True)
754
 
755
+ # ایجاد خط و نقاط با HTML/CSS
756
  scale_html = f"""
757
  <style>
 
 
 
758
  .likert-line {{
759
  width: 80%;
760
  height: 2px;
 
762
  margin: 0 auto;
763
  position: relative;
764
  display: flex;
765
+ justify-content: space-between;
766
  }}
767
  .likert-dot {{
768
  width: 20px;
 
776
  display: flex;
777
  align-items: center;
778
  justify-content: center;
 
779
  }}
780
  .likert-dot.selected {{
781
  background: #6a0dad;
 
792
  margin-top: 10px;
793
  color: #6a0dad;
794
  font-weight: bold;
 
795
  }}
796
  @media (max-width: 768px) {{
797
  .likert-line {{
 
811
  <div class='likert-line'>
812
  """
813
 
814
+ # اضافه کردن نقاط
815
  for i in range(scale):
816
+ value = scale - i
817
  is_selected = st.session_state.get(key) == value
818
  scale_html += f"<div class='likert-dot {'selected' if is_selected else ''}' onclick='setLikertValue({value})'></div>"
819
 
 
840
  </script>
841
  """, height=80)
842
 
843
+ # دکمه‌های واقعی (مخفی)
844
  btn_cols = st.columns(scale)
845
  for i in range(scale):
846
  with btn_cols[i]:
847
+ value = scale - i
848
  if st.button(
849
  str(value),
850
  key=f"{key}_btn_{value}",