mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
30 lines
812 B
Python
30 lines
812 B
Python
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()
|