catlendar

This commit is contained in:
2025-09-05 23:37:46 -04:00
parent 9f424fc6ea
commit 18c64907d4
7 changed files with 140 additions and 0 deletions

34
caltui.py Normal file
View File

@@ -0,0 +1,34 @@
from textual.app import App, ComposeResult
from textual.binding import Binding
from textual.widgets import Footer, Header, Label, ListItem, ListView
from main import get_next_ten
class Catlendar(App):
"""A Textual app to manage stopwatches."""
BINDINGS = [
("d", "toggle_dark", "Toggle dark mode"),
Binding(key="q", action="quit", description="Quit the app"),
]
def compose(self) -> ComposeResult:
"""Create child widgets for the app."""
next_ten = get_next_ten()
yield Header()
yield ListView(
*[ListItem(Label(x)) for x in next_ten]
)
yield Footer()
def action_toggle_dark(self) -> None:
"""An action to toggle dark mode."""
self.theme = (
"textual-dark" if self.theme == "textual-light" else "textual-light"
)
if __name__ == "__main__":
app = Catlendar()
app.run()