more docs

This commit is contained in:
Will McGugan
2022-07-30 17:01:51 +01:00
parent 7ba36c1146
commit 7040d00c7b
22 changed files with 534 additions and 31 deletions

29
examples/borders.py Normal file
View File

@@ -0,0 +1,29 @@
from itertools import cycle
from textual.app import App
from textual.color import Color
from textual.constants import BORDERS
from textual.widgets import Static
class BorderApp(App):
"""Displays a pride flag."""
COLORS = ["red", "orange", "yellow", "green", "blue", "purple"]
def compose(self):
self.dark = True
for border, color in zip(BORDERS, cycle(self.COLORS)):
static = Static(f"border: {border} {color};")
static.styles.height = 7
static.styles.background = Color.parse(color).with_alpha(0.2)
static.styles.margin = (1, 2)
static.styles.border = (border, color)
static.styles.content_align = ("center", "middle")
yield static
app = BorderApp()
if __name__ == "__main__":
app.run()