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]
36 lines
780 B
Python
36 lines
780 B
Python
from textual.app import App, ComposeResult
|
|
from textual.widgets import Label
|
|
from textual.containers import Container
|
|
|
|
|
|
# Test fr dimensions and margins work in an auto container
|
|
# https://github.com/Textualize/textual/issues/2220
|
|
class TestApp(App):
|
|
CSS = """
|
|
Container {
|
|
background: green 20%;
|
|
border: heavy green;
|
|
width: auto;
|
|
height: auto;
|
|
overflow: hidden;
|
|
}
|
|
|
|
Label {
|
|
background: green 20%;
|
|
width: 1fr;
|
|
height: 1fr;
|
|
margin: 2 2;
|
|
}
|
|
"""
|
|
|
|
def compose(self) -> ComposeResult:
|
|
with Container():
|
|
yield Label("Hello")
|
|
yield Label("World")
|
|
yield Label("!!")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
app = TestApp()
|
|
app.run()
|