Skip to content
Discussion options

You must be logged in to vote

If that's the effect you're after, then I wouldn't use a Grid for the main layout. Instead I'd probably go with a Vertical of your own widget, which will handle it's own columnar layout:

from textual.app import App, ComposeResult
from textual.containers import Vertical, Grid
from textual.widgets import Static


class Row(Grid):

    DEFAULT_CSS = """
    Row {
        grid-size: 2;
    }
    """

    def compose(self) -> ComposeResult:
        yield Static("Column 1")
        yield Static("Column 2")

class Demo(App):

    def compose(self) -> ComposeResult:
        with Vertical():
            for i in range(9):
                yield Row()

if __name__ == "__main__":
    Demo().run()

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@multimeric
Comment options

@davep
Comment options

Answer selected by multimeric
@multimeric
Comment options

@davep
Comment options

@multimeric
Comment options

@mon
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants