Files
textual/tests/snapshot_tests/snapshot_apps/auto_fr.py
Will McGugan 44367a7422 Expanding fr (#2221)
* forced fr to expand

* margin size

* remove comment

* missing snapshot

* snapshot tests

* changelog

* optimize

* snapshot fix

* snapshot update

* snapshot and fixes

* docstrings [skip ci]
2023-04-06 17:30:32 +01:00

41 lines
808 B
Python

from textual.app import App, ComposeResult
from textual.widget import Widget
from textual.widgets import Label
class FRApp(App):
CSS = """
Screen {
align: center middle;
border: solid cyan;
}
#container {
width: 30;
height: auto;
border: solid green;
overflow-y: auto;
}
#child {
height: 1fr;
border: solid red;
}
#bottom {
margin: 1 2;
background: $primary;
}
"""
def compose(self) -> ComposeResult:
with Widget(id="container"):
yield Label("Hello one line", id="top")
yield Widget(id="child")
yield Label("Two\nLines with 1x2 margin", id="bottom")
if __name__ == "__main__":
app = FRApp()
app.run()