File tree Expand file tree Collapse file tree 12 files changed +584
-10
lines changed Expand file tree Collapse file tree 12 files changed +584
-10
lines changed Original file line number Diff line number Diff line change 1+ from textual .app import App , ComposeResult
2+ from textual .containers import Horizontal
3+ from textual .widgets import Placeholder
4+
5+
6+ class Box (Placeholder ):
7+ """Example widget."""
8+
9+ DEFAULT_CSS = """
10+ Box {
11+ width: 16;
12+ height: 8;
13+ }
14+ """
15+
16+
17+ class ContainerApp (App ):
18+ """Simple app to play with containers."""
19+
20+ def compose (self ) -> ComposeResult :
21+ with Horizontal (): # (1)!
22+ yield Box () # (2)!
23+ yield Box ()
24+ yield Box ()
25+
26+
27+ if __name__ == "__main__" :
28+ app = ContainerApp ()
29+ app .run ()
Original file line number Diff line number Diff line change 1+ from textual .app import App , ComposeResult
2+ from textual .containers import Vertical
3+ from textual .widgets import Placeholder
4+
5+
6+ class Box (Placeholder ):
7+ """Example widget."""
8+
9+ DEFAULT_CSS = """
10+ Box {
11+ width: 16;
12+ height: 8;
13+ }
14+ """
15+
16+
17+ class ContainerApp (App ):
18+ """Simple app to play with containers."""
19+
20+ def compose (self ) -> ComposeResult :
21+ with Vertical (): # (1)!
22+ yield Box ()
23+ yield Box ()
24+ yield Box ()
25+
26+
27+ if __name__ == "__main__" :
28+ app = ContainerApp ()
29+ app .run ()
Original file line number Diff line number Diff line change 1+ from textual .app import App , ComposeResult
2+ from textual .containers import Horizontal
3+ from textual .widgets import Placeholder
4+
5+
6+ class Box (Placeholder ):
7+ """Example widget."""
8+
9+ DEFAULT_CSS = """
10+ Box {
11+ width: 16;
12+ height: 8;
13+ }
14+ """
15+
16+
17+ class ContainerApp (App ):
18+ """Simple app to play with containers."""
19+
20+ CSS = """
21+ .with-border {
22+ border: heavy green;
23+ }
24+ """
25+
26+ def compose (self ) -> ComposeResult :
27+ with Horizontal (classes = "with-border" ): # (1)!
28+ yield Box ()
29+ yield Box ()
30+ yield Box ()
31+
32+
33+ if __name__ == "__main__" :
34+ app = ContainerApp ()
35+ app .run ()
Original file line number Diff line number Diff line change 1+ from textual .app import App , ComposeResult
2+ from textual .containers import Horizontal
3+ from textual .widgets import Placeholder
4+
5+
6+ class Box (Placeholder ):
7+ """Example widget."""
8+
9+ DEFAULT_CSS = """
10+ Box {
11+ width: 16;
12+ height: 8;
13+ }
14+ """
15+
16+
17+ class ContainerApp (App ):
18+ """Simple app to play with containers."""
19+
20+ CSS = """
21+ .with-border {
22+ border: heavy green;
23+ }
24+ """
25+
26+ def compose (self ) -> ComposeResult :
27+ with Horizontal (classes = "with-border" ):
28+ yield Box ()
29+ yield Box ()
30+ yield Box ()
31+ with Horizontal (classes = "with-border" ):
32+ yield Box ()
33+ yield Box ()
34+ yield Box ()
35+
36+
37+ if __name__ == "__main__" :
38+ app = ContainerApp ()
39+ app .run ()
Original file line number Diff line number Diff line change 1+ from textual .app import App , ComposeResult
2+ from textual .containers import HorizontalGroup
3+ from textual .widgets import Placeholder
4+
5+
6+ class Box (Placeholder ):
7+ """Example widget."""
8+
9+ DEFAULT_CSS = """
10+ Box {
11+ width: 16;
12+ height: 8;
13+ }
14+ """
15+
16+
17+ class ContainerApp (App ):
18+ """Simple app to play with containers."""
19+
20+ CSS = """
21+ .with-border {
22+ border: heavy green;
23+ }
24+ """
25+
26+ def compose (self ) -> ComposeResult :
27+ with HorizontalGroup (classes = "with-border" ):
28+ yield Box ()
29+ yield Box ()
30+ yield Box ()
31+ with HorizontalGroup (classes = "with-border" ):
32+ yield Box ()
33+ yield Box ()
34+ yield Box ()
35+
36+
37+ if __name__ == "__main__" :
38+ app = ContainerApp ()
39+ app .run ()
Original file line number Diff line number Diff line change 1+ from textual .app import App , ComposeResult
2+ from textual .containers import Horizontal
3+ from textual .widgets import Placeholder
4+
5+
6+ class Box (Placeholder ):
7+ """Example widget."""
8+
9+ DEFAULT_CSS = """
10+ Box {
11+ width: 16;
12+ height: 8;
13+ }
14+ """
15+
16+
17+ class ContainerApp (App ):
18+ """Simple app to play with containers."""
19+
20+ CSS = """
21+ .with-border {
22+ border: heavy green;
23+ }
24+ """
25+
26+ def compose (self ) -> ComposeResult :
27+ with Horizontal (classes = "with-border" ):
28+ for n in range (10 ):
29+ yield Box (label = f"Box { n + 1 } " )
30+
31+
32+ if __name__ == "__main__" :
33+ app = ContainerApp ()
34+ app .run ()
Original file line number Diff line number Diff line change 1+ from textual .app import App , ComposeResult
2+ from textual .containers import HorizontalScroll
3+ from textual .widgets import Placeholder
4+
5+
6+ class Box (Placeholder ):
7+ """Example widget."""
8+
9+ DEFAULT_CSS = """
10+ Box {
11+ width: 16;
12+ height: 8;
13+ }
14+ """
15+
16+
17+ class ContainerApp (App ):
18+ """Simple app to play with containers."""
19+
20+ CSS = """
21+ .with-border {
22+ border: heavy green;
23+ }
24+ """
25+
26+ def compose (self ) -> ComposeResult :
27+ with HorizontalScroll (classes = "with-border" ):
28+ for n in range (10 ):
29+ yield Box (label = f"Box { n + 1 } " )
30+
31+
32+ if __name__ == "__main__" :
33+ app = ContainerApp ()
34+ app .run ()
Original file line number Diff line number Diff line change 1+ from textual .app import App , ComposeResult
2+ from textual .containers import Center , Right
3+ from textual .widgets import Placeholder
4+
5+
6+ class Box (Placeholder ):
7+ """Example widget."""
8+
9+ DEFAULT_CSS = """
10+ Box {
11+ width: 16;
12+ height: 5;
13+ }
14+ """
15+
16+
17+ class ContainerApp (App ):
18+ """Simple app to play with containers."""
19+
20+ CSS = """
21+ .with-border {
22+ border: heavy green;
23+ }
24+ """
25+
26+ def compose (self ) -> ComposeResult :
27+ yield Box ("Box 1" ) # (1)!
28+ with Center (classes = "with-border" ): # (2)!
29+ yield Box ("Box 2" )
30+ with Right (classes = "with-border" ): # (3)!
31+ yield Box ("Box 3" )
32+
33+
34+ if __name__ == "__main__" :
35+ app = ContainerApp ()
36+ app .run ()
Original file line number Diff line number Diff line change 1+ from textual .app import App , ComposeResult
2+ from textual .containers import Middle
3+ from textual .widgets import Placeholder
4+
5+
6+ class Box (Placeholder ):
7+ """Example widget."""
8+
9+ DEFAULT_CSS = """
10+ Box {
11+ width: 16;
12+ height: 5;
13+ }
14+ """
15+
16+
17+ class ContainerApp (App ):
18+ """Simple app to play with containers."""
19+
20+ CSS = """
21+ .with-border {
22+ border: heavy green;
23+ }
24+ """
25+
26+ def compose (self ) -> ComposeResult :
27+ with Middle (classes = "with-border" ): # (1)!
28+ yield Box ("Box 1." )
29+ yield Box ("Box 2." )
30+ yield Box ("Box 3." )
31+
32+
33+ if __name__ == "__main__" :
34+ app = ContainerApp ()
35+ app .run ()
You can’t perform that action at this time.
0 commit comments