Document setting app (sub)title.

This commit is contained in:
Rodrigo Girão Serrão
2023-01-31 17:31:06 +00:00
parent 6f24331564
commit c14f635244
3 changed files with 85 additions and 1 deletions

View File

@@ -0,0 +1,22 @@
from textual.app import App, ComposeResult
from textual.widgets import Button, Header, Label
class MyApp(App[str]):
TITLE = "A Question App"
SUB_TITLE = "The most important question"
def compose(self) -> ComposeResult:
yield Header()
yield Label("Do you love Textual?")
yield Button("Yes", id="yes", variant="primary")
yield Button("No", id="no", variant="error")
def on_button_pressed(self, event: Button.Pressed) -> None:
self.exit(event.button.id)
if __name__ == "__main__":
app = MyApp()
reply = app.run()
print(reply)