Files
textual/docs/examples/styles/text_align.py
Rodrigo Girão Serrão 042bc3b3fe Improve text-align example.
Replace statics with labels; change to a 2 x 2 grid layout to make it easier to see the difference between 'center' and 'justify'; increase readability by setting 'color: auto' in the labels.
2023-01-06 10:41:46 +00:00

23 lines
664 B
Python

from textual.app import App
from textual.containers import Grid
from textual.widgets import Label
TEXT = (
"I must not fear. Fear is the mind-killer. Fear is the little-death that "
"brings total obliteration. I will face my fear. I will permit it to pass over "
"me and through me."
)
class TextAlign(App):
def compose(self):
yield Grid(
Label("[b]Left aligned[/]\n" + TEXT, id="one"),
Label("[b]Center aligned[/]\n" + TEXT, id="two"),
Label("[b]Right aligned[/]\n" + TEXT, id="three"),
Label("[b]Justified[/]\n" + TEXT, id="four"),
)
app = TextAlign(css_path="text_align.css")