mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
added grid layout
This commit is contained in:
@@ -129,7 +129,7 @@ Running this app will give you the following:
|
||||
|
||||
Clicking either of those buttons will exit the app, and the `run()` method will return either `"yes"` or `"no"` depending on button clicked.
|
||||
|
||||
#### Typing
|
||||
#### Return type
|
||||
|
||||
You may have noticed that we subclassed `App[str]` rather than the usual `App`.
|
||||
|
||||
@@ -137,7 +137,9 @@ You may have noticed that we subclassed `App[str]` rather than the usual `App`.
|
||||
--8<-- "docs/examples/app/question01.py"
|
||||
```
|
||||
|
||||
The addition of `[str]` tells Mypy that `run()` is expected to return a string. It may also return `None` if `sys.exit()` is called without a return value, so the return type of `run` will be `str | None`.
|
||||
The addition of `[str]` tells Mypy that `run()` is expected to return a string. It may also return `None` if [App.exit()][textual.app.App.exit] is called without a return value, so the return type of `run` will be `str | None`.
|
||||
|
||||
You can change the type to match the values you intend to pass to App.exit()][textual.app.App.exit].
|
||||
|
||||
!!! note
|
||||
|
||||
|
||||
@@ -2,19 +2,22 @@
|
||||
|
||||
The `layout` property defines how a widget arranges its children.
|
||||
|
||||
See [layout](../guide/layout.md) guide for more information.
|
||||
|
||||
## Syntax
|
||||
|
||||
```
|
||||
layout: [vertical|horizontal|center];
|
||||
layout: [center|grid|horizontal|vertical];
|
||||
```
|
||||
|
||||
### Values
|
||||
|
||||
| Value | Description |
|
||||
|----------------------|-------------------------------------------------------------------------------|
|
||||
| `vertical` (default) | Child widgets will be arranged along the vertical axis, from top to bottom. |
|
||||
| `horizontal` | Child widgets will be arranged along the horizontal axis, from left to right. |
|
||||
| `center` | A single child widget will be placed in the center. |
|
||||
| `grid` | Child widgets will be arranged in a grid. |
|
||||
| `horizontal` | Child widgets will be arranged along the horizontal axis, from left to right. |
|
||||
| `vertical` (default) | Child widgets will be arranged along the vertical axis, from top to bottom. |
|
||||
|
||||
## Example
|
||||
|
||||
|
||||
Reference in New Issue
Block a user