Merge pull request #2286 from davep/faqup

Update the centring FAQ to reference `Center`
This commit is contained in:
Dave Pearson
2023-04-15 09:05:07 +01:00
committed by GitHub
2 changed files with 10 additions and 26 deletions

20
FAQ.md
View File

@@ -105,23 +105,15 @@ If you want them more like this:
+---------------+
```
the best approach is to wrap each widget in a container that individually
centers it. For example:
the best approach is to wrap each widget in a [`Center`
container](https://textual.textualize.io/api/containers/#textual.containers.Center)
that individually centers it. For example:
```python
from textual.app import App, ComposeResult
from textual.containers import Container
from textual.containers import Center
from textual.widgets import Button
class Center( Container ):
DEFAULT_CSS = """
Center {
height: auto;
width: 100%;
align: center middle;
}
"""
class ButtonApp(App):
CSS = """
@@ -182,7 +174,7 @@ terminal application. Which keys get passed on can differ from terminal to
terminal, and from operating system to operating system.
Because of this it's best to stick to key combinations that are known to be
universally-supported; these include:
universally-supported; these include the likes of:
- Letters
- Numbers
@@ -230,4 +222,4 @@ There is currently a light and dark version of the design system, but more are p
<hr>
Generated by [FAQtory](https://github.com/willmcgugan/faqtory)
Generated by [FAQtory](https://github.com/willmcgugan/faqtory)

View File

@@ -69,23 +69,15 @@ If you want them more like this:
+---------------+
```
the best approach is to wrap each widget in a container that individually
centers it. For example:
the best approach is to wrap each widget in a [`Center`
container](https://textual.textualize.io/api/containers/#textual.containers.Center)
that individually centers it. For example:
```python
from textual.app import App, ComposeResult
from textual.containers import Container
from textual.containers import Center
from textual.widgets import Button
class Center( Container ):
DEFAULT_CSS = """
Center {
height: auto;
width: 100%;
align: center middle;
}
"""
class ButtonApp(App):
CSS = """