mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
23 lines
540 B
Python
23 lines
540 B
Python
from textual.app import App, ComposeResult
|
|
from textual.widgets import Header, Footer
|
|
|
|
|
|
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()
|
|
|
|
def action_toggle_dark(self) -> None:
|
|
"""An action to toggle dark mode."""
|
|
self.dark = not self.dark
|
|
|
|
|
|
app = StopwatchApp()
|
|
if __name__ == "__main__":
|
|
app.run()
|