💭 Center things - Textual ========================= !https://textual.textualize.io/how-to/center-things/ Date: July 30, 2023 Textual - Center things Textual is a TUI framework for Python, inspired by modern web development. Textual Documentation · textual.textualize.io [1] How to center things in textual. Textual has a very unique way of styling text user interfaces for the terminal using css. If you know css it feels natural. @willmcgugan [2], has put together a great article on how to center things in textual here the final result ``` python from textual.app import App, ComposeResult from textual.widgets import Static QUOTE = "Could not find you in Seattle and no terminal is in operation at your classified address." class CenterApp(App): """How to center things.""" CSS = """ Screen { align: center middle; } #hello { background: blue 50%; border: wide white; width: 40; height: 9; text-align: center; content-align: center middle; } """ def compose(self) -> ComposeResult: yield Static(QUOTE, id="hello") if __name__ == "__main__": app = CenterApp() app.run() ``` !!! note This post is a thought [3]. It's a short note that I make about someone else's content online #thoughts [4] References: [1]: https://textual.textualize.io/how-to/center-things/ [2]: https://willmcgugan.github.io [3]: /thoughts/ [4]: /tags/thoughts/