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() for key, item in next_ten.items(): yield Label(key) yield ListView( *[ListItem(Label(x)) for x in item] ) 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()