diff --git a/python-textual/events.py b/python-textual/events.py index e1c96b5d6c..15ffd118b9 100644 --- a/python-textual/events.py +++ b/python-textual/events.py @@ -14,10 +14,7 @@ class EventsApp(App): double_border = False def compose(self): - yield Button( - "Click me!", - id="button", - ) + yield Button("Click me!", id="button") digits = Digits("0", id="digits") digits.border_subtitle = "Button presses" yield digits diff --git a/python-textual/grid.py b/python-textual/grid.py index 4b8219aba8..c21b34370e 100644 --- a/python-textual/grid.py +++ b/python-textual/grid.py @@ -3,7 +3,7 @@ from textual.widgets import Static -class GridLayoutExample(App): +class GridLayoutApp(App): def compose(self): grid = Grid() grid.styles.grid_size_rows = rows = 6 @@ -19,5 +19,5 @@ def compose(self): if __name__ == "__main__": - app = GridLayoutExample() + app = GridLayoutApp() app.run() diff --git a/python-textual/grid.tcss b/python-textual/grid.tcss index 443ffc6ee2..627a39f257 100644 --- a/python-textual/grid.tcss +++ b/python-textual/grid.tcss @@ -5,5 +5,5 @@ Grid { Static { height: 1fr; width: 1fr; - border: solid green; + border: solid green; } \ No newline at end of file diff --git a/python-textual/grid_with_tcss.py b/python-textual/grid_tcss.py similarity index 83% rename from python-textual/grid_with_tcss.py rename to python-textual/grid_tcss.py index d76333a457..222e994b37 100644 --- a/python-textual/grid_with_tcss.py +++ b/python-textual/grid_tcss.py @@ -3,7 +3,7 @@ from textual.widgets import Static -class GridLayoutWithTCSS(App): +class GridLayoutAppWithTCSS(App): CSS_PATH = "grid.tcss" def compose(self): @@ -14,5 +14,5 @@ def compose(self): if __name__ == "__main__": - app = GridLayoutWithTCSS() + app = GridLayoutAppWithTCSS() app.run() diff --git a/python-textual/horizontal_layout.py b/python-textual/horizontal_layout.py index d4456a8e95..d9ec1812da 100644 --- a/python-textual/horizontal_layout.py +++ b/python-textual/horizontal_layout.py @@ -5,16 +5,16 @@ NUM_BOXES = 4 -class HorizontalLayoutExample(App): +class HorizontalLayoutApp(App): def compose(self): with Horizontal(): for i in range(NUM_BOXES): - static = Static(f"Static {i+1}") + static = Static(f"Static {i + 1}") static.styles.border = ("solid", "green") static.styles.width = "10%" yield static if __name__ == "__main__": - app = HorizontalLayoutExample() + app = HorizontalLayoutApp() app.run() diff --git a/python-textual/horizontal_scroll.py b/python-textual/horizontal_scroll.py index 301cfc4e5d..20a2171939 100644 --- a/python-textual/horizontal_scroll.py +++ b/python-textual/horizontal_scroll.py @@ -5,16 +5,16 @@ NUM_BOXES = 20 -class HorizontalScrollExample(App): +class HorizontalScrollApp(App): def compose(self): with HorizontalScroll(): for i in range(NUM_BOXES): - static = Static(f"Static {i+1}") + static = Static(f"Static {i + 1}") static.styles.border = ("solid", "green") static.styles.width = "10%" yield static if __name__ == "__main__": - app = HorizontalScrollExample() + app = HorizontalScrollApp() app.run() diff --git a/python-textual/layouts.py.py b/python-textual/layouts.py similarity index 77% rename from python-textual/layouts.py.py rename to python-textual/layouts.py index a32572265b..e48c7438c7 100644 --- a/python-textual/layouts.py.py +++ b/python-textual/layouts.py @@ -1,15 +1,11 @@ from textual.app import App -from textual.containers import ( - Horizontal, - HorizontalScroll, - VerticalScroll, -) +from textual.containers import Horizontal, HorizontalScroll, VerticalScroll from textual.widgets import Label, Static NUM_BOXES = 12 -class NestedContainersExample(App): +class NestedContainersApp(App): CSS_PATH = "layouts.tcss" def compose(self): @@ -18,13 +14,13 @@ def compose(self): with HorizontalScroll(id="horizontalscroll"): for i in range(NUM_BOXES): yield Static( - f"Center.{i+1}", + f"Center.{i + 1}", classes="box yellowbox", ) with VerticalScroll(id="verticalscroll"): for i in range(NUM_BOXES): yield Static( - f"Right.{i+1}", + f"Right.{i + 1}", classes="box redbox", ) yield Label( @@ -34,5 +30,5 @@ def compose(self): if __name__ == "__main__": - app = NestedContainersExample() + app = NestedContainersApp() app.run() diff --git a/python-textual/layouts.tcss b/python-textual/layouts.tcss index 7a8b793c77..ba378376a4 100644 --- a/python-textual/layouts.tcss +++ b/python-textual/layouts.tcss @@ -1,7 +1,7 @@ .box { height: 1fr; width: 1fr; - background:$panel; + background: $panel; border: solid white; } diff --git a/python-textual/static_and_label.py b/python-textual/static_and_label.py index 5158a367da..1e45389059 100644 --- a/python-textual/static_and_label.py +++ b/python-textual/static_and_label.py @@ -18,13 +18,13 @@ def on_mount(self): self.static.styles.background = "blue" self.static.styles.border = ("solid", "white") self.static.styles.text_align = "center" - self.static.styles.padding = 1, 1 - self.static.styles.margin = 4, 4 + self.static.styles.padding = (1, 1) + self.static.styles.margin = (4, 4) # Styling the label self.label.styles.background = "darkgreen" self.label.styles.border = ("double", "red") - self.label.styles.padding = 1, 1 - self.label.styles.margin = 2, 4 + self.label.styles.padding = (1, 1) + self.label.styles.margin = (2, 4) if __name__ == "__main__": diff --git a/python-textual/static_and_label.tcss b/python-textual/static_and_label.tcss index 5152b4c141..547643a88f 100644 --- a/python-textual/static_and_label.tcss +++ b/python-textual/static_and_label.tcss @@ -1,6 +1,6 @@ Static { background: blue; - border: solid white; + border: solid white; padding: 1 1; margin: 2 2; text-align: center; @@ -8,16 +8,16 @@ Static { #label_id { color: black; - background: yellow; - border: solid black; + background: red; + border: solid black; padding: 1 1; margin: 2 4; } .label_class { - color:black; + color: black; background: green; - border: dashed purple; + border: dashed purple; padding: 1 1; margin: 2 6; -} \ No newline at end of file +} diff --git a/python-textual/vertical_layout.py.py b/python-textual/vertical_layout.py similarity index 67% rename from python-textual/vertical_layout.py.py rename to python-textual/vertical_layout.py index e6669789c7..8a88aa5b15 100644 --- a/python-textual/vertical_layout.py.py +++ b/python-textual/vertical_layout.py @@ -5,20 +5,20 @@ NUM_BOXES = 4 -class VerticalLayoutExample(App): +class VerticalLayoutApp(App): def compose(self): with Vertical(): for i in range(NUM_BOXES): - static = Static(f"Static {i+1}") + static = Static(f"Static {i + 1}") static.styles.border = ("solid", "green") yield static - # for i in range(1, NUM_BOXES): - # static = Static(f"Static {i}") + # for i in range(NUM_BOXES): + # static = Static(f"Static {i + 1}") # static.styles.border = ("solid", "green") # yield static if __name__ == "__main__": - app = VerticalLayoutExample() + app = VerticalLayoutApp() app.run() diff --git a/python-textual/vertical_layout_tcss.py.py b/python-textual/vertical_layout_tcss.py similarity index 80% rename from python-textual/vertical_layout_tcss.py.py rename to python-textual/vertical_layout_tcss.py index c405e3085b..791b8c9315 100644 --- a/python-textual/vertical_layout_tcss.py.py +++ b/python-textual/vertical_layout_tcss.py @@ -5,7 +5,7 @@ NUM_BOXES = 4 -class VerticalLayoutExampleWithTCSS(App): +class VerticalLayoutAppWithTCSS(App): CSS_PATH = "vertical_layout.tcss" def compose(self): @@ -15,5 +15,5 @@ def compose(self): if __name__ == "__main__": - app = VerticalLayoutExampleWithTCSS() + app = VerticalLayoutAppWithTCSS() app.run() diff --git a/python-textual/vertical_scroll.py b/python-textual/vertical_scroll.py index 9abecda85b..9542aa04d3 100644 --- a/python-textual/vertical_scroll.py +++ b/python-textual/vertical_scroll.py @@ -5,7 +5,7 @@ NUM_BOXES = 20 -class VerticalScrollExample(App): +class VerticalScrollApp(App): CSS_PATH = "vertical_layout.tcss" def compose(self): @@ -15,5 +15,5 @@ def compose(self): if __name__ == "__main__": - app = VerticalScrollExample() + app = VerticalScrollApp() app.run()