mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
fix stopwatch example
This commit is contained in:
@@ -21,16 +21,14 @@ class Stopwatch(Static):
|
||||
class StopwatchApp(App):
|
||||
"""A Textual app to manage stopwatches."""
|
||||
|
||||
BINDINGS = [("d", "toggle_dark", "Toggle dark mode")]
|
||||
|
||||
def compose(self) -> ComposeResult:
|
||||
"""Create child widgets for the app."""
|
||||
yield Header()
|
||||
yield Footer()
|
||||
yield Container(Stopwatch(), Stopwatch(), Stopwatch())
|
||||
|
||||
def on_load(self) -> None:
|
||||
"""Event handler called when app first loads."""
|
||||
self.bind("d", "toggle_dark", description="Dark mode")
|
||||
|
||||
def action_toggle_dark(self) -> None:
|
||||
"""An action to toggle dark mode."""
|
||||
self.dark = not self.dark
|
||||
|
||||
Reference in New Issue
Block a user