from textual.app import App, ComposeResult from textual.containers import ScrollableContainer from textual.widgets import Header, Footer, Button, Static, DirectoryTree class ProjectItem(Static): def compose(self) -> ComposeResult: yield Button("HHHH", id="project_name") yield DirectoryTree("./") class MyApp(App): CSS_PATH = "app.tcss" BINDINGS = [ ("d", "toggle_dark", "Toggle dark mode") ] def compose(self) -> ComposeResult: yield Footer() yield Header() yield ProjectItem() def action_toggle_dark(self): self.dark = not self.dark # -- if __name__ == "__main__": app = MyApp() app.run()