mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
* 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>
22 lines
657 B
Python
22 lines
657 B
Python
from textual.app import App, ComposeResult
|
|
from textual.widgets import Static, Header
|
|
|
|
TEXT = """\
|
|
Docking a widget removes it from the layout and fixes its position, aligned to either the top, right, bottom, or left edges of a container.
|
|
|
|
Docked widgets will not scroll out of view, making them ideal for sticky headers, footers, and sidebars.
|
|
|
|
"""
|
|
|
|
|
|
class DockLayoutExample(App):
|
|
def compose(self) -> ComposeResult:
|
|
yield Header(id="header")
|
|
yield Static("Sidebar1", id="sidebar")
|
|
yield Static(TEXT * 10, id="body")
|
|
|
|
|
|
app = DockLayoutExample(css_path="dock_layout3_sidebar_header.css")
|
|
if __name__ == "__main__":
|
|
app.run()
|