-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Expand file tree
/
Copy pathlayouts.py
More file actions
34 lines (28 loc) · 1.03 KB
/
layouts.py
File metadata and controls
34 lines (28 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from textual.app import App
from textual.containers import Horizontal, HorizontalScroll, VerticalScroll
from textual.widgets import Label, Static
NUM_BOXES = 12
class NestedContainersApp(App):
CSS_PATH = "layouts.tcss"
def compose(self):
with Horizontal(id="horizontal"):
yield Static("Left", classes="box")
with HorizontalScroll(id="horizontalscroll"):
for i in range(NUM_BOXES):
yield Static(
f"Center.{i + 1}",
classes="box yellowbox",
)
with VerticalScroll(id="verticalscroll"):
for i in range(NUM_BOXES):
yield Static(
f"Right.{i + 1}",
classes="box redbox",
)
yield Label(
"I am a docked label.\nI don't move!",
id="docked-label",
)
if __name__ == "__main__":
app = NestedContainersApp()
app.run()