GSMEthesis commited on
Commit
f59b1e8
·
verified ·
1 Parent(s): 373aad3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +57 -15
app.py CHANGED
@@ -771,21 +771,63 @@ def create_likert_question(question, key, scale_type="5point"):
771
  """,
772
  unsafe_allow_html=True
773
  )
774
- st.components.v1.html(f"""
775
- <script>
776
- (function() {{
777
- const slider = parent.document.querySelector('[data-testid="stSlider"] [aria-valuenow="{value}"]');
778
- if(slider) {{
779
- slider.parentElement.style.background = `repeating-linear-gradient(
780
- to right,
781
- #6a0dad, #6a0dad 2px,
782
- transparent 2px, transparent calc(100%/{max_value-1} - 1px),
783
- #6a0dad calc(100%/{max_value-1}), #6a0dad calc(100%/{max_value-1} + 1px)
784
- )`;
785
- }}
786
- }})();
787
- </script>
788
- """, height=0)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
789
 
790
  return value
791
 
 
771
  """,
772
  unsafe_allow_html=True
773
  )
774
+
775
+ st.markdown("""
776
+ <style>
777
+ /* پایه‌ای ترین تنظیمات جهت */
778
+ * {
779
+ direction: rtl !important;
780
+ text-align: right !important;
781
+ font-family: 'B Nazanin' !important;
782
+ }
783
+
784
+ /* تنظیمات کلی صفحه */
785
+ .stApp {
786
+ text-align: right !important;
787
+ direction: rtl !important;
788
+ }
789
+
790
+ /* اصلاح دکمه‌ها */
791
+ .stButton>button {
792
+ margin-right: auto !important;
793
+ margin-left: 0 !important;
794
+ display: block !important;
795
+ }
796
+
797
+ /* اسلایدرها */
798
+ div[data-testid="stSlider"] {
799
+ direction: ltr !important; /* اسلایدرها باید LTR باشند */
800
+ }
801
+
802
+ /* لیبل‌ها */
803
+ .stSlider>label, .stRadio>label, .stSelectbox>label {
804
+ text-align: right !important;
805
+ right: 0 !important;
806
+ left: auto !important;
807
+ }
808
+
809
+ /* محتوای کشویی */
810
+ .st-b7, .st-b8, .st-b9 {
811
+ text-align: right !important;
812
+ }
813
+
814
+ /* جلوگیری از پرت شدن المان‌ها */
815
+ div[data-testid="stVerticalBlock"] {
816
+ padding-right: 1rem !important;
817
+ padding-left: 1rem !important;
818
+ }
819
+
820
+ /* اسکرول افقی */
821
+ html {
822
+ overflow-x: hidden !important;
823
+ }
824
+ body {
825
+ position: relative !important;
826
+ right: 0 !important;
827
+ transition: right 0.3s !important;
828
+ }
829
+ </style>
830
+ """, unsafe_allow_html=True)
831
 
832
  return value
833