Switch docstring additions and tweaks

This commit is contained in:
Dave Pearson
2023-02-09 16:06:00 +00:00
parent 1956f7f9d7
commit be9e34ba9a

View File

@@ -144,12 +144,17 @@ class Switch(Widget, can_focus=True):
return 1 return 1
def on_click(self) -> None: def on_click(self) -> None:
"""Toggle the state of the switch."""
self.toggle() self.toggle()
def action_toggle(self) -> None: def action_toggle(self) -> None:
"""Toggle the state of the switch."""
self.toggle() self.toggle()
def toggle(self) -> None: def toggle(self) -> None:
"""Toggle the switch value. As a result of the value changing, """Toggle the switch value.
a Switch.Changed message will be posted."""
As a result of the value changing, a `Switch.Changed` message will
be posted.
"""
self.value = not self.value self.value = not self.value