mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Add a disabled keyword argument to the Switch constructor
This commit is contained in:
@@ -100,6 +100,7 @@ class Switch(Widget, can_focus=True):
|
||||
name: str | None = None,
|
||||
id: str | None = None,
|
||||
classes: str | None = None,
|
||||
disabled: bool = False,
|
||||
):
|
||||
"""Initialise the switch.
|
||||
|
||||
@@ -109,8 +110,9 @@ class Switch(Widget, can_focus=True):
|
||||
name: The name of the switch.
|
||||
id: The ID of the switch in the DOM.
|
||||
classes: The CSS classes of the switch.
|
||||
disabled: Whether the switch is disabled or not.
|
||||
"""
|
||||
super().__init__(name=name, id=id, classes=classes)
|
||||
super().__init__(name=name, id=id, classes=classes, disabled=disabled)
|
||||
if value:
|
||||
self.slider_pos = 1.0
|
||||
self._reactive_value = value
|
||||
|
||||
Reference in New Issue
Block a user