mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
* forced fr to expand * margin size * remove comment * missing snapshot * snapshot tests * changelog * optimize * snapshot fix * snapshot update * snapshot and fixes * docstrings [skip ci]
41 lines
808 B
Python
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()
|