streamlit-toggle-diy 1.0.1__tar.gz → 1.1.4__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. streamlit_toggle_diy-1.1.4/MANIFEST.in +3 -0
  2. streamlit_toggle_diy-1.1.4/PKG-INFO +88 -0
  3. streamlit_toggle_diy-1.1.4/README.md +76 -0
  4. streamlit_toggle_diy-1.1.4/setup.py +30 -0
  5. streamlit_toggle_diy-1.1.4/streamlit_toggle_diy/__init__.py +295 -0
  6. streamlit_toggle_diy-1.1.4/streamlit_toggle_diy/frontend/build/asset-manifest.json +19 -0
  7. streamlit_toggle_diy-1.1.4/streamlit_toggle_diy/frontend/build/bootstrap.min.css +9501 -0
  8. streamlit_toggle_diy-1.1.4/streamlit_toggle_diy/frontend/build/index.html +1 -0
  9. streamlit_toggle_diy-1.1.4/streamlit_toggle_diy/frontend/build/precache-manifest.b7df6085566f07f8f27b94ee8ed2d302.js +22 -0
  10. streamlit_toggle_diy-1.1.4/streamlit_toggle_diy/frontend/build/service-worker.js +39 -0
  11. streamlit_toggle_diy-1.1.4/streamlit_toggle_diy/frontend/build/static/js/2.9720bf9e.chunk.js +3 -0
  12. streamlit_toggle_diy-1.1.4/streamlit_toggle_diy/frontend/build/static/js/2.9720bf9e.chunk.js.LICENSE.txt +68 -0
  13. streamlit_toggle_diy-1.1.4/streamlit_toggle_diy/frontend/build/static/js/2.9720bf9e.chunk.js.map +1 -0
  14. streamlit_toggle_diy-1.1.4/streamlit_toggle_diy/frontend/build/static/js/main.9f3c3eed.chunk.js +2 -0
  15. streamlit_toggle_diy-1.1.4/streamlit_toggle_diy/frontend/build/static/js/main.9f3c3eed.chunk.js.map +1 -0
  16. streamlit_toggle_diy-1.1.4/streamlit_toggle_diy/frontend/build/static/js/runtime-main.cc20bba3.js +2 -0
  17. streamlit_toggle_diy-1.1.4/streamlit_toggle_diy/frontend/build/static/js/runtime-main.cc20bba3.js.map +1 -0
  18. streamlit_toggle_diy-1.1.4/streamlit_toggle_diy/frontend/public/bootstrap.min.css +9501 -0
  19. streamlit_toggle_diy-1.1.4/streamlit_toggle_diy/frontend/public/index.html +25 -0
  20. streamlit_toggle_diy-1.1.4/streamlit_toggle_diy/frontend/src/index.tsx +11 -0
  21. streamlit_toggle_diy-1.1.4/streamlit_toggle_diy/frontend/src/react-app-env.d.ts +1 -0
  22. streamlit_toggle_diy-1.1.4/streamlit_toggle_diy/frontend/src/streamlit_toggle.tsx +170 -0
  23. streamlit_toggle_diy-1.1.4/streamlit_toggle_diy/frontend/src/style.css +6 -0
  24. streamlit_toggle_diy-1.1.4/streamlit_toggle_diy.egg-info/PKG-INFO +88 -0
  25. streamlit_toggle_diy-1.1.4/streamlit_toggle_diy.egg-info/SOURCES.txt +28 -0
  26. streamlit_toggle_diy-1.0.1/MANIFEST.in +0 -1
  27. streamlit_toggle_diy-1.0.1/PKG-INFO +0 -10
  28. streamlit_toggle_diy-1.0.1/README.md +0 -29
  29. streamlit_toggle_diy-1.0.1/setup.py +0 -20
  30. streamlit_toggle_diy-1.0.1/streamlit_toggle_diy/__init__.py +0 -140
  31. streamlit_toggle_diy-1.0.1/streamlit_toggle_diy.egg-info/PKG-INFO +0 -10
  32. streamlit_toggle_diy-1.0.1/streamlit_toggle_diy.egg-info/SOURCES.txt +0 -10
  33. {streamlit_toggle_diy-1.0.1 → streamlit_toggle_diy-1.1.4}/LICENSE +0 -0
  34. {streamlit_toggle_diy-1.0.1 → streamlit_toggle_diy-1.1.4}/setup.cfg +0 -0
  35. {streamlit_toggle_diy-1.0.1 → streamlit_toggle_diy-1.1.4}/streamlit_toggle_diy.egg-info/dependency_links.txt +0 -0
  36. {streamlit_toggle_diy-1.0.1 → streamlit_toggle_diy-1.1.4}/streamlit_toggle_diy.egg-info/requires.txt +0 -0
  37. {streamlit_toggle_diy-1.0.1 → streamlit_toggle_diy-1.1.4}/streamlit_toggle_diy.egg-info/top_level.txt +0 -0
@@ -0,0 +1,3 @@
1
+ recursive-include streamlit_toggle_diy/frontend/build *
2
+ recursive-include streamlit_toggle_diy/frontend/src *
3
+ recursive-include streamlit_toggle_diy/frontend/public *
@@ -0,0 +1,88 @@
1
+ Metadata-Version: 2.1
2
+ Name: streamlit_toggle_diy
3
+ Version: 1.1.4
4
+ Summary: A customized Streamlit toggle switch component with customizable labels, colors, and border radius
5
+ Home-page: https://github.com/flowing-water1/streamlit-toggle-switch-diy
6
+ Author: Flow Water
7
+ Author-email: 1665526933@qq.com
8
+ Requires-Python: >=3.6
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: streamlit>=0.63
12
+
13
+ # streamlit-toggle-diy
14
+
15
+ Creates a toggle switch with color and placement customizations, and you can change the label's color, radius, font size, and more.
16
+
17
+ ## Function
18
+
19
+ - Customize label background color
20
+ - Customize the text color, font size, and font weight for both labels
21
+ - Customize the Switch size (small or medium)
22
+ - Customize the background color near the button
23
+ - Custom rounded corners
24
+ - Support multiple layout methods
25
+
26
+ ## Installation
27
+
28
+ ```shell
29
+ pip install streamlit-toggle-diy
30
+ ```
31
+
32
+ ## Usage
33
+
34
+ ```python
35
+ import streamlit as st
36
+ import streamlit-toggle-diy as tog
37
+
38
+ tog.st_toggle_switch(
39
+ key=None,
40
+ label_start="111",
41
+ label_end="",
42
+ justify='flex-start',
43
+ default_value=False,
44
+ inactive_color='#D3D3D3',
45
+ active_color="#11567f",
46
+ track_color="#29B5E8",
47
+ label_bg_color_start=None,
48
+ label_bg_color_end=None,
49
+ background_color_near_button_start=None,
50
+ background_color_near_button_end=None,
51
+ border_radius=None,
52
+ )
53
+ ```
54
+
55
+ ## Parameters
56
+
57
+
58
+ | **Parameter Name** | **Type** | **Default** | **Description** |
59
+ | ------------------------------------------ | ------------------------------------ | -------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
60
+ | **key** | `str` | None | The unique identifier for each component instance.<br />Used to distinguish different component instances in the Streamlit application. |
61
+ | **label\_start** | `str` | `""` | The text content of the label before the switch. If a preceding label is not needed, pass an empty string`""`. |
62
+ | **label\_end** | `str` | `""` | The text content of the label after the switch. If a following label is not needed, pass an empty string`""`. |
63
+ | **justify** | `{'flex-start','center','flex-end'}` | `'flex-start'` | Controls alignment of labels and the switch within the container. |
64
+ | **default\_value** | `bool` | `False` | The initial state of the toggle switch.`True`= On,`False`= Off. |
65
+ | **inactive\_color** | `str` | `'#D3D3D3'` | The color of the slider when the switch is inactive (off). |
66
+ | **active\_color** | `str` | `'#11567f'` | The color of the slider when the switch is active (on). |
67
+ | **track\_color** | `str` | `'#29B5E8'` | The color of the switch track (background). |
68
+ | **label\_bg\_color\_start** | `str` | `None` | The starting value of the label background color, used to create a gradient effect. |
69
+ | **label\_bg\_color\_end** | `str` | `None` | The ending value of the label background color, used to create a gradient effect. |
70
+ | **background\_color\_near\_button\_start** | `str` | `None` | The starting value of the background color near the switch, used to create a gradient effect behind the component. |
71
+ | **background\_color\_near\_button\_end** | `str` | `None` | The ending value of the background color near the switch, used to create a gradient effect behind the component. |
72
+ | **border\_radius** | `str` | `None` | The border-radius of the component, such as`'4px'`,`'8px'`,`'50%'`, etc. |
73
+ | **label\_start\_color** | `str` | `"#7f1916"` | Text color for the left (start) label. |
74
+ | **label\_end\_color** | `str` | `"#FFFFFF"` | Text color for the right (end) label. |
75
+ | **label\_font\_size** | `str` | `"14px"` | Font size for both labels (e.g.`"14px"`,`"12pt"`). |
76
+ | **label\_font\_weight** | `str` | `"bold"` | Font weight for both labels (e.g.`"bold"`,`"normal"`,`"500"`). |
77
+ | **switch\_size** | `{'small','medium'}` | `"medium"` | The size of the Switch component. |
78
+
79
+ > **Note**:
80
+ >
81
+ > * If both `label_bg_color_start` and `label_bg_color_end` are set, a gradient background for the label(s) will be created.
82
+ > * If both `background_color_near_button_start` and `background_color_near_button_end` are provided, a gradient behind the switch is created.
83
+ > * If you only provide one color, it will be used as a solid background.
84
+ > * `label_start_color` and `label_end_color` control the text color of labels, while `label_bg_color_start` and `label_bg_color_end` control the background of those labels.
85
+
86
+ ## Operation
87
+
88
+ ![streamlit.gif](assets/streamlit.gif)
@@ -0,0 +1,76 @@
1
+ # streamlit-toggle-diy
2
+
3
+ Creates a toggle switch with color and placement customizations, and you can change the label's color, radius, font size, and more.
4
+
5
+ ## Function
6
+
7
+ - Customize label background color
8
+ - Customize the text color, font size, and font weight for both labels
9
+ - Customize the Switch size (small or medium)
10
+ - Customize the background color near the button
11
+ - Custom rounded corners
12
+ - Support multiple layout methods
13
+
14
+ ## Installation
15
+
16
+ ```shell
17
+ pip install streamlit-toggle-diy
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ```python
23
+ import streamlit as st
24
+ import streamlit-toggle-diy as tog
25
+
26
+ tog.st_toggle_switch(
27
+ key=None,
28
+ label_start="111",
29
+ label_end="",
30
+ justify='flex-start',
31
+ default_value=False,
32
+ inactive_color='#D3D3D3',
33
+ active_color="#11567f",
34
+ track_color="#29B5E8",
35
+ label_bg_color_start=None,
36
+ label_bg_color_end=None,
37
+ background_color_near_button_start=None,
38
+ background_color_near_button_end=None,
39
+ border_radius=None,
40
+ )
41
+ ```
42
+
43
+ ## Parameters
44
+
45
+
46
+ | **Parameter Name** | **Type** | **Default** | **Description** |
47
+ | ------------------------------------------ | ------------------------------------ | -------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
48
+ | **key** | `str` | None | The unique identifier for each component instance.<br />Used to distinguish different component instances in the Streamlit application. |
49
+ | **label\_start** | `str` | `""` | The text content of the label before the switch. If a preceding label is not needed, pass an empty string`""`. |
50
+ | **label\_end** | `str` | `""` | The text content of the label after the switch. If a following label is not needed, pass an empty string`""`. |
51
+ | **justify** | `{'flex-start','center','flex-end'}` | `'flex-start'` | Controls alignment of labels and the switch within the container. |
52
+ | **default\_value** | `bool` | `False` | The initial state of the toggle switch.`True`= On,`False`= Off. |
53
+ | **inactive\_color** | `str` | `'#D3D3D3'` | The color of the slider when the switch is inactive (off). |
54
+ | **active\_color** | `str` | `'#11567f'` | The color of the slider when the switch is active (on). |
55
+ | **track\_color** | `str` | `'#29B5E8'` | The color of the switch track (background). |
56
+ | **label\_bg\_color\_start** | `str` | `None` | The starting value of the label background color, used to create a gradient effect. |
57
+ | **label\_bg\_color\_end** | `str` | `None` | The ending value of the label background color, used to create a gradient effect. |
58
+ | **background\_color\_near\_button\_start** | `str` | `None` | The starting value of the background color near the switch, used to create a gradient effect behind the component. |
59
+ | **background\_color\_near\_button\_end** | `str` | `None` | The ending value of the background color near the switch, used to create a gradient effect behind the component. |
60
+ | **border\_radius** | `str` | `None` | The border-radius of the component, such as`'4px'`,`'8px'`,`'50%'`, etc. |
61
+ | **label\_start\_color** | `str` | `"#7f1916"` | Text color for the left (start) label. |
62
+ | **label\_end\_color** | `str` | `"#FFFFFF"` | Text color for the right (end) label. |
63
+ | **label\_font\_size** | `str` | `"14px"` | Font size for both labels (e.g.`"14px"`,`"12pt"`). |
64
+ | **label\_font\_weight** | `str` | `"bold"` | Font weight for both labels (e.g.`"bold"`,`"normal"`,`"500"`). |
65
+ | **switch\_size** | `{'small','medium'}` | `"medium"` | The size of the Switch component. |
66
+
67
+ > **Note**:
68
+ >
69
+ > * If both `label_bg_color_start` and `label_bg_color_end` are set, a gradient background for the label(s) will be created.
70
+ > * If both `background_color_near_button_start` and `background_color_near_button_end` are provided, a gradient behind the switch is created.
71
+ > * If you only provide one color, it will be used as a solid background.
72
+ > * `label_start_color` and `label_end_color` control the text color of labels, while `label_bg_color_start` and `label_bg_color_end` control the background of those labels.
73
+
74
+ ## Operation
75
+
76
+ ![streamlit.gif](assets/streamlit.gif)
@@ -0,0 +1,30 @@
1
+ import setuptools
2
+ import os
3
+
4
+ # 读取 README.md 内容
5
+ with open("README.md", "r", encoding="utf-8") as fh:
6
+ long_description = fh.read()
7
+
8
+ setuptools.setup(
9
+ name="streamlit_toggle_diy",
10
+ version="1.1.4",
11
+ author="Flow Water",
12
+ author_email="1665526933@qq.com",
13
+ description="A customized Streamlit toggle switch component with customizable labels, colors, and border radius",
14
+ long_description=long_description, # 设置长描述
15
+ long_description_content_type="text/markdown", # 指定内容类型为 Markdown
16
+ url="https://github.com/flowing-water1/streamlit-toggle-switch-diy",
17
+ packages=setuptools.find_packages(),
18
+ include_package_data=True,
19
+ package_data={
20
+ "streamlit_toggle_diy": [
21
+ "frontend/build/**/*",
22
+ "frontend/public/**/*",
23
+ ],
24
+ },
25
+ classifiers=[],
26
+ python_requires=">=3.6",
27
+ install_requires=[
28
+ "streamlit >= 0.63",
29
+ ],
30
+ )
@@ -0,0 +1,295 @@
1
+ import os
2
+ import streamlit.components.v1 as components
3
+ import streamlit as st
4
+
5
+ _RELEASE = True
6
+
7
+ if not _RELEASE:
8
+ _component_func = components.declare_component(
9
+ "streamlit_toggle_diy",
10
+ url="http://localhost:3001", # 本地开发时的地址
11
+ )
12
+ else:
13
+ parent_dir = os.path.dirname(os.path.abspath(__file__))
14
+ build_dir = os.path.join(parent_dir, "frontend/build")
15
+ _component_func = components.declare_component("streamlit_toggle_diy", path=build_dir)
16
+
17
+
18
+ def st_toggle_switch(
19
+ key=None,
20
+ label_start="", # 前标签文字
21
+ label_end="", # 后标签文字
22
+ justify='flex-start', # 对齐方式
23
+ default_value=False, # 默认开关状态
24
+ inactive_color='#CEE8FF',
25
+ active_color="#00668c",
26
+ track_color="#3D5A80",
27
+ label_bg_color_start="#FFFFFF",
28
+ label_bg_color_end="yellow",
29
+ background_color_near_button_start="#FFFFFF",
30
+ background_color_near_button_end="#FFFFFF",
31
+ border_radius='30px',
32
+ label_start_color="#333333",
33
+ label_end_color="red",
34
+ label_font_size="16px",
35
+ label_font_weight="bold",
36
+ switch_size="medium",
37
+ ):
38
+ """
39
+ 在 Streamlit 中创建一个可自定义颜色、大小的切换开关组件。
40
+
41
+ Parameters
42
+ ----------
43
+ key: str
44
+ 组件在 session_state 中的 key,用于区分多个组件实例。
45
+ label_start: str
46
+ 开关左侧标签文字。
47
+ label_end: str
48
+ 开关右侧标签文字。
49
+ justify: {'flex-start', 'center', 'flex-end'}
50
+ 标签和开关在容器中的对齐方式。
51
+ default_value: bool
52
+ 开关的默认状态,True 为打开,False 为关闭。
53
+ inactive_color: str
54
+ 开关未激活时的按钮颜色。
55
+ active_color: str
56
+ 开关激活时的按钮颜色。
57
+ track_color: str
58
+ 开关轨道(背景)的颜色。
59
+ label_bg_color_start: str
60
+ 左 / 上方标签背景色(如果需要渐变,可与 label_bg_color_end 联合使用)。
61
+ label_bg_color_end: str
62
+ 右 / 下方标签背景色(如果需要渐变,可与 label_bg_color_start 联合使用)。
63
+ background_color_near_button_start: str
64
+ 开关附近背景的起始颜色(可配合 background_color_near_button_end 做渐变)。
65
+ background_color_near_button_end: str
66
+ 开关附近背景的结束颜色(可配合 background_color_near_button_start 做渐变)。
67
+ border_radius: str
68
+ 组件的圆角,如 '4px', '8px', '50%' 等。
69
+
70
+ label_start_color: str
71
+ 前标签文字颜色(默认为 #7f1916)。
72
+ label_end_color: str
73
+ 后标签文字颜色(默认为 #FFFFFF)。
74
+ label_font_size: str
75
+ 标签文字的字体大小(如 '14px' 等)。
76
+ label_font_weight: str
77
+ 标签文字的粗细(如 'bold', 'normal', '500' 等)。
78
+ switch_size: {'small', 'medium'}
79
+ 切换开关本身的尺寸。
80
+
81
+ Returns
82
+ -------
83
+ bool
84
+ 返回切换后的状态。如果无法获取,则返回 default_value。
85
+ """
86
+
87
+ toggle_value = _component_func(
88
+ key=key,
89
+ default_value=default_value,
90
+ label_start=label_start,
91
+ label_end=label_end,
92
+ justify=justify,
93
+ inactive_color=inactive_color,
94
+ active_color=active_color,
95
+ track_color=track_color,
96
+ label_bg_color_start=label_bg_color_start,
97
+ label_bg_color_end=label_bg_color_end,
98
+ background_color_near_button_start=background_color_near_button_start,
99
+ background_color_near_button_end=background_color_near_button_end,
100
+ border_radius=border_radius,
101
+ label_start_color=label_start_color,
102
+ label_end_color=label_end_color,
103
+ label_font_size=label_font_size,
104
+ label_font_weight=label_font_weight,
105
+ switch_size=switch_size,
106
+ )
107
+ return toggle_value if toggle_value is not None else default_value
108
+
109
+
110
+ # 仅在开发环境时演示组件效果
111
+ if not _RELEASE:
112
+ st.header('Streamlit Toggle Switch - Dev Mode')
113
+ st.write('---')
114
+
115
+ # 使用 color_picker 选择不同颜色
116
+ color1_start = st.color_picker('选择 Question 1 标签起始背景颜色', '#FFD700')
117
+ color1_end = st.color_picker('选择 Question 1 标签结束背景颜色', '#FF8C00')
118
+
119
+ color2_start = st.color_picker('选择 Question 2 标签起始背景颜色', '#ADFF2F')
120
+ color2_end = st.color_picker('选择 Question 2 标签结束背景颜色', '#32CD32')
121
+
122
+ color3_start = st.color_picker('选择 Question 3 标签起始背景颜色', '#1E90FF')
123
+ color3_end = st.color_picker('选择 Question 3 标签结束背景颜色', '#0000FF')
124
+
125
+ color4_start = st.color_picker('选择 Question 4 标签起始背景颜色', '#FF69B4')
126
+ color4_end = st.color_picker('选择 Question 4 标签结束背景颜色', '#FF1493')
127
+
128
+ color5_start = st.color_picker('选择 Disable Filter 标签起始背景颜色', '#00FA9A')
129
+ color5_end = st.color_picker('选择 Disable Filter 标签结束背景颜色', '#00FF7F')
130
+
131
+ # 新增颜色选择器用于按钮附近的背景颜色
132
+ button_bg_start = st.color_picker('按钮附近的起始背景颜色', '#FFFFFF')
133
+ button_bg_end = st.color_picker('按钮附近的结束背景颜色', '#FFFFFF')
134
+
135
+ # 新增圆角选择器
136
+ border_radius = st.text_input('组件圆角(如:4px, 8px, 50%)', '8px')
137
+
138
+ # 新增对齐方式选择器
139
+ justify = st.selectbox(
140
+ '标签与开关的对齐方式',
141
+ ('flex-start', 'center', 'flex-end')
142
+ )
143
+
144
+ # 新增标签文字颜色选择
145
+ label_start_color = st.color_picker("左侧标签文字颜色", "#7f1916")
146
+ label_end_color = st.color_picker("右侧标签文字颜色", "#FFFFFF")
147
+
148
+ # 标签字体大小与粗细
149
+ label_font_size = st.text_input("标签字体大小", "14px")
150
+ label_font_weight = st.text_input("标签字体粗细", "bold")
151
+
152
+ # Switch 尺寸选择器
153
+ switch_size = st.selectbox(
154
+ "Switch 尺寸",
155
+ ("small", "medium")
156
+ )
157
+
158
+ columns = st.columns(3)
159
+ with columns[0]:
160
+ st_toggle_switch(
161
+ key='c1',
162
+ label_start="Question 1",
163
+ label_end="", # 不显示后标签
164
+ justify=justify,
165
+ default_value=True,
166
+ inactive_color='#D3D3D3',
167
+ active_color="#11567f",
168
+ track_color="#29B5E8",
169
+ label_bg_color_start=color1_start,
170
+ label_bg_color_end=color1_end,
171
+ background_color_near_button_start=button_bg_start,
172
+ background_color_near_button_end=button_bg_end,
173
+ border_radius=border_radius,
174
+ label_start_color=label_start_color,
175
+ label_end_color=label_end_color,
176
+ label_font_size=label_font_size,
177
+ label_font_weight=label_font_weight,
178
+ switch_size=switch_size,
179
+ )
180
+
181
+ st_toggle_switch(
182
+ key="input_toggle",
183
+ label_start="",
184
+ label_end="Question 2",
185
+ justify='flex-start',
186
+ default_value=True,
187
+ inactive_color='#95e1d3',
188
+ active_color="#f38181",
189
+ track_color="#f38181",
190
+ label_bg_color_start='white',
191
+ label_bg_color_end='black',
192
+ background_color_near_button_start='blue',
193
+ background_color_near_button_end='black',
194
+ border_radius='10px',
195
+ label_start_color="#000000",
196
+ label_end_color="#FFFFFF",
197
+ label_font_size="12px",
198
+ label_font_weight="normal",
199
+ switch_size="small",
200
+ )
201
+
202
+ with columns[1]:
203
+ st_toggle_switch(
204
+ key='q2',
205
+ label_start="", # 不显示前标签
206
+ label_end="Question 3",
207
+ justify=justify,
208
+ default_value=True,
209
+ inactive_color='#DDA0DD',
210
+ active_color="#9400D3",
211
+ track_color="#BA55D3",
212
+ label_bg_color_start=color3_start,
213
+ label_bg_color_end=color3_end,
214
+ background_color_near_button_start=button_bg_start,
215
+ background_color_near_button_end=button_bg_end,
216
+ border_radius=border_radius,
217
+ label_start_color=label_start_color,
218
+ label_end_color=label_end_color,
219
+ label_font_size=label_font_size,
220
+ label_font_weight=label_font_weight,
221
+ switch_size=switch_size,
222
+ )
223
+ st_toggle_switch(
224
+ key='q3',
225
+ label_start="", # 不显示前标签
226
+ label_end="Question 4",
227
+ justify=justify,
228
+ default_value=False,
229
+ inactive_color='#FFA07A',
230
+ active_color="#FF4500",
231
+ track_color="#FF6347",
232
+ label_bg_color_start=color4_start,
233
+ label_bg_color_end=color4_end,
234
+ background_color_near_button_start=button_bg_start,
235
+ background_color_near_button_end=button_bg_end,
236
+ border_radius=border_radius,
237
+ label_start_color=label_start_color,
238
+ label_end_color=label_end_color,
239
+ label_font_size=label_font_size,
240
+ label_font_weight=label_font_weight,
241
+ switch_size=switch_size,
242
+ )
243
+
244
+ with columns[2]:
245
+ st_toggle_switch(
246
+ key='q1',
247
+ label_start="Disable Filter",
248
+ label_end="", # 不显示后标签
249
+ justify=justify,
250
+ default_value=True,
251
+ inactive_color='#98FB98',
252
+ active_color="#00FF7F",
253
+ track_color="#00FA9A",
254
+ label_bg_color_start=color5_start,
255
+ label_bg_color_end=color5_end,
256
+ background_color_near_button_start=button_bg_start,
257
+ background_color_near_button_end=button_bg_end,
258
+ border_radius=border_radius,
259
+ label_start_color=label_start_color,
260
+ label_end_color=label_end_color,
261
+ label_font_size=label_font_size,
262
+ label_font_weight=label_font_weight,
263
+ switch_size=switch_size,
264
+ )
265
+ range_slider_toggle = st_toggle_switch(
266
+ key='ql',
267
+ label_start="Disable Filter",
268
+ label_end="", # 不显示后标签
269
+ justify=justify,
270
+ default_value=True,
271
+ inactive_color='#98FB98',
272
+ active_color="#00FF7F",
273
+ track_color="#00FA9A",
274
+ label_bg_color_start=color5_start,
275
+ label_bg_color_end=color5_end,
276
+ background_color_near_button_start=button_bg_start,
277
+ background_color_near_button_end=button_bg_end,
278
+ border_radius=border_radius,
279
+ label_start_color=label_start_color,
280
+ label_end_color=label_end_color,
281
+ label_font_size=label_font_size,
282
+ label_font_weight=label_font_weight,
283
+ switch_size=switch_size,
284
+ )
285
+ range_slider = st.slider(
286
+ label="Filter Range",
287
+ min_value=0,
288
+ max_value=100,
289
+ disabled=range_slider_toggle,
290
+ )
291
+
292
+ st_toggle_switch(
293
+ key='q4',
294
+ label_start="Disable Filter",
295
+ label_end="Disable Filter",)
@@ -0,0 +1,19 @@
1
+ {
2
+ "files": {
3
+ "main.js": "./static/js/main.9f3c3eed.chunk.js",
4
+ "main.js.map": "./static/js/main.9f3c3eed.chunk.js.map",
5
+ "runtime-main.js": "./static/js/runtime-main.cc20bba3.js",
6
+ "runtime-main.js.map": "./static/js/runtime-main.cc20bba3.js.map",
7
+ "static/js/2.9720bf9e.chunk.js": "./static/js/2.9720bf9e.chunk.js",
8
+ "static/js/2.9720bf9e.chunk.js.map": "./static/js/2.9720bf9e.chunk.js.map",
9
+ "index.html": "./index.html",
10
+ "precache-manifest.b7df6085566f07f8f27b94ee8ed2d302.js": "./precache-manifest.b7df6085566f07f8f27b94ee8ed2d302.js",
11
+ "service-worker.js": "./service-worker.js",
12
+ "static/js/2.9720bf9e.chunk.js.LICENSE.txt": "./static/js/2.9720bf9e.chunk.js.LICENSE.txt"
13
+ },
14
+ "entrypoints": [
15
+ "static/js/runtime-main.cc20bba3.js",
16
+ "static/js/2.9720bf9e.chunk.js",
17
+ "static/js/main.9f3c3eed.chunk.js"
18
+ ]
19
+ }