diff --git a/docs/examples/app/question_title01.py b/docs/examples/app/question_title01.py index e597a4746..55dc43599 100644 --- a/docs/examples/app/question_title01.py +++ b/docs/examples/app/question_title01.py @@ -3,12 +3,13 @@ from textual.widgets import Button, Header, Label class MyApp(App[str]): + CSS_PATH = "question02.css" TITLE = "A Question App" SUB_TITLE = "The most important question" def compose(self) -> ComposeResult: yield Header() - yield Label("Do you love Textual?") + yield Label("Do you love Textual?", id="question") yield Button("Yes", id="yes", variant="primary") yield Button("No", id="no", variant="error") diff --git a/docs/examples/app/question_title02.py b/docs/examples/app/question_title02.py index 91ebf96ab..c279d7e20 100644 --- a/docs/examples/app/question_title02.py +++ b/docs/examples/app/question_title02.py @@ -4,12 +4,13 @@ from textual.widgets import Button, Header, Label class MyApp(App[str]): + CSS_PATH = "question02.css" TITLE = "A Question App" SUB_TITLE = "The most important question" def compose(self) -> ComposeResult: yield Header() - yield Label("Do you love Textual?") + yield Label("Do you love Textual?", id="question") yield Button("Yes", id="yes", variant="primary") yield Button("No", id="no", variant="error") diff --git a/docs/guide/app.md b/docs/guide/app.md index b11d02184..eaa874ed3 100644 --- a/docs/guide/app.md +++ b/docs/guide/app.md @@ -192,7 +192,7 @@ Textual apps have a `title` attribute which is typically the name of your applic By default, `title` will be set to the name of your App class, and `sub_title` is empty. You can change these defaults by defining `TITLE` and `SUB_TITLE` class variables. Here's an example of that: -```py title="question_title01.py" hl_lines="6-7 10" +```py title="question_title01.py" hl_lines="7-8 11" --8<-- "docs/examples/app/question_title01.py" ``` @@ -203,7 +203,7 @@ Note that the title and subtitle are displayed by the builtin [Header](./../widg You can also set the title attributes dynamically within a method of your app. The following example sets the title and subtitle in response to a key press: -```py title="question_title02.py" hl_lines="19-21" +```py title="question_title02.py" hl_lines="20-22" --8<-- "docs/examples/app/question_title02.py" ```