css align

This commit is contained in:
Will McGugan
2022-04-14 13:10:49 +01:00
parent 69694c4591
commit 8e76e524a8
13 changed files with 188 additions and 44 deletions

19
sandbox/align.css Normal file
View File

@@ -0,0 +1,19 @@
Screen {
layout: horizontal;
}
Widget#thing {
width: 20;
height: 10;
align: center middle;
}
Widget#thing2 {
width: 30;
height: 8;
align: center middle;
background: green;
}

17
sandbox/align.py Normal file
View File

@@ -0,0 +1,17 @@
from textual.app import App
from textual.widget import Widget
class AlignApp(App):
def on_load(self):
self.bind("t", "log_tree")
def on_mount(self) -> None:
self.log("MOUNTED")
self.mount(thing=Widget(), thing2=Widget())
def action_log_tree(self):
self.log(self.screen.tree)
AlignApp.run(css_file="align.css", log="textual.log", watch_css=True)