mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Add example to compare all heights.
This commit is contained in:
28
docs/examples/styles/height_comparison.py
Normal file
28
docs/examples/styles/height_comparison.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from textual.app import App
|
||||
from textual.containers import Vertical
|
||||
from textual.widgets import Placeholder, Label, Static
|
||||
|
||||
|
||||
class VerticalRuler(Static):
|
||||
def compose(self):
|
||||
ruler_text = "\n".join(map(str, range(1, 100)))
|
||||
yield Label(ruler_text)
|
||||
|
||||
|
||||
class HeightComparisonApp(App):
|
||||
def compose(self):
|
||||
yield Vertical(
|
||||
Placeholder(id="cells"), # (1)!
|
||||
Placeholder(id="percent"),
|
||||
Placeholder(id="w"),
|
||||
Placeholder(id="h"),
|
||||
Placeholder(id="vw"),
|
||||
Placeholder(id="vh"),
|
||||
Placeholder(id="auto"),
|
||||
Placeholder(id="fr1"),
|
||||
Placeholder(id="fr2"),
|
||||
)
|
||||
yield VerticalRuler()
|
||||
|
||||
|
||||
app = HeightComparisonApp(css_path="height_comparison.css")
|
||||
Reference in New Issue
Block a user