MCPcopy Create free account
hub / github.com/CJackHwang/AIstudioProxyAPI / CTkSettingRow

Class CTkSettingRow

gui/widgets.py:142–328  ·  view source on GitHub ↗

A single setting row with label and appropriate input widget. Supports: - bool: CTkSwitch - int/float: CTkEntry with validation - choice: CTkComboBox - string: CTkEntry

Source from the content-addressed store, hash-verified

140
141
142class CTkSettingRow(ctk.CTkFrame):
143 """
144 A single setting row with label and appropriate input widget.
145
146 Supports:
147 - bool: CTkSwitch
148 - int/float: CTkEntry with validation
149 - choice: CTkComboBox
150 - string: CTkEntry
151 """
152
153 def __init__(
154 self,
155 master: Any,
156 key: str,
157 label: str,
158 value: Any,
159 type_hint: str,
160 tooltip: Optional[str] = None,
161 on_change: Optional[Callable[[str, Any], None]] = None,
162 **kwargs,
163 ):
164 """
165 Initialize a setting row.
166
167 Args:
168 master: Parent widget
169 key: Setting key (env variable name)
170 label: Display label
171 value: Current value
172 type_hint: Type hint (bool, int, float, choice:a,b,c, or string)
173 tooltip: Optional tooltip text
174 on_change: Callback when value changes (receives key and new value)
175 """
176 kwargs.setdefault("fg_color", "transparent")
177 super().__init__(master, **kwargs)
178
179 self._key = key
180 self._type_hint = type_hint
181 self._on_change = on_change
182 self._value_var: Any = None
183
184 # Configure grid
185 self.grid_columnconfigure(0, weight=0, minsize=280)
186 self.grid_columnconfigure(1, weight=1)
187
188 # Create label
189 self._label = ctk.CTkLabel(
190 self,
191 text=label,
192 font=ctk.CTkFont(size=FONTS["size_normal"]),
193 text_color=COLORS["text_primary"],
194 anchor="w",
195 )
196 self._label.grid(row=0, column=0, sticky="w", padx=(0, 10), pady=5)
197
198 # Create input widget based on type
199 self._create_input(value)

Callers 1

_build_settings_uiMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected