mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Merge pull request #916 from davep/css-docs-review-actions
CSS docs review - Actions
This commit is contained in:
@@ -42,7 +42,7 @@ Action strings have the following format:
|
||||
|
||||
- The name of an action on is own will call the action method with no parameters. For example, an action string of `"bell"` will call `action_bell()`.
|
||||
- Actions may be followed by braces containing Python objects. For example, the action string `set_background("red")` will call `action_set_background("red")`.
|
||||
- Actions may be prefixed with a _namespace_ (see below) follow by a dot.
|
||||
- Actions may be prefixed with a _namespace_ (see below) follow by a dot.
|
||||
|
||||
<div class="excalidraw">
|
||||
--8<-- "docs/images/actions/format.excalidraw.svg"
|
||||
@@ -50,7 +50,7 @@ Action strings have the following format:
|
||||
|
||||
### Parameters
|
||||
|
||||
If the action strings contains parameters, these must be valid Python literals. Which means you can include numbers, strings, dicts, lists etc. but you can't include variables or references to any other python symbols.
|
||||
If the action string contains parameters, these must be valid Python literals. Which means you can include numbers, strings, dicts, lists etc. but you can't include variables or references to any other python symbol.
|
||||
|
||||
Consequently `"set_background('blue')"` is a valid action string, but `"set_background(new_color)"` is not — because `new_color` is a variable and not a literal.
|
||||
|
||||
@@ -71,7 +71,7 @@ The following example mounts simple static text with embedded action links.
|
||||
```{.textual path="docs/examples/guide/actions/actions03.py"}
|
||||
```
|
||||
|
||||
When you click any of the links, Textual runs the `"set_background"` action to change the background to the given color and plays the terminals bell.
|
||||
When you click any of the links, Textual runs the `"set_background"` action to change the background to the given color and plays the terminal's bell.
|
||||
|
||||
## Bindings
|
||||
|
||||
@@ -104,7 +104,7 @@ The following example defines a custom widget with its own `set_background` acti
|
||||
|
||||
=== "actions05.css"
|
||||
|
||||
```sass title="actions05.css"
|
||||
```sass title="actions05.css"
|
||||
--8<-- "docs/examples/guide/actions/actions05.css"
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user