This commit is contained in:
Will McGugan
2024-11-19 14:51:00 +00:00
parent e40f95d4f9
commit c12fe839e9

View File

@@ -353,7 +353,7 @@ Some of the new styles have more than one selector separated by a space. The spa
```
The `.started` selector matches any widget with a `"started"` CSS class.
While `#start` matches a child widget with an ID of `"start"`.
While `#start` matches a widget with an ID of `"start"`.
Combining the two selectors with a space (`.started #start`) creates a new selector that will match the start button *only* if it is also inside a container with a CSS class of "started".
As before, the `display: none` rule will cause any matching widgets to be hidden from view.
@@ -377,6 +377,8 @@ The `on_button_pressed` method is an *event handler*. Event handlers are methods
Event handlers begin with `on_` followed by the name of the event they will handle.
Hence `on_button_pressed` will handle the button pressed event.
See the guide on [message handlers](./guide/events.md#message-handlers) for the details on how to write event handlers.
If you run `stopwatch04.py` now you will be able to toggle between the two states by clicking the first button:
```{.textual path="docs/examples/tutorial/stopwatch04.py" title="stopwatch04.py" press="tab,tab,tab,enter"}