Files
textual/docs/examples/guide/layout/combining_layouts.py
darrenburns 5ef98aac90 Initial layout guide stuff (#748)
* Initial layout guide stuff

* More docs on layout - grid

* Continuing grid docs

* Grid gutter and spans guide

* Improvements to layout docs for horizontal, vertical, dock, and begin describing layers

* Update center layout example to reflect new yield order

* More updates to layout guide, mostly offset stuff

* More layout guide, "Putting it all together"

* Updates to layout guide page

* Small rewording of dock layout in guide

* Apostrophe

* Typo

* Small design tweak to combining layouts example

* Typos, tidying up

* Small reword

* Some updates to docs/guide/layout/grid

* calc fix

Co-authored-by: Will McGugan <willmcgugan@gmail.com>
2022-09-15 15:28:23 +01:00

44 lines
1.3 KiB
Python

from textual import layout
from textual.app import ComposeResult, App
from textual.widgets import Static, Header
class CombiningLayoutsExample(App):
def compose(self) -> ComposeResult:
yield Header()
yield layout.Container(
layout.Vertical(
*[Static(f"Vertical layout, child {number}") for number in range(15)],
id="left-pane",
),
layout.Horizontal(
Static("Horizontally"),
Static("Positioned"),
Static("Children"),
Static("Here"),
id="top-right",
),
layout.Container(
Static("This"),
Static("panel"),
Static("is"),
Static("using"),
Static("grid layout!", id="bottom-right-final"),
id="bottom-right",
),
id="app-grid",
)
async def on_key(self, event) -> None:
await self.dispatch_key(event)
def key_a(self):
print(self.stylesheet.variables["boost"])
print(self.stylesheet.variables["boost-lighten-1"])
print(self.stylesheet.variables["boost-lighten-2"])
app = CombiningLayoutsExample(css_path="combining_layouts.css")
if __name__ == "__main__":
app.run()