Skip to content
Discussion options

You must be logged in to vote

In a situation like the DataTable needs a hight; for example:

from textual.app import App
from textual.widgets import DataTable, Label, TabbedContent


DATA = [("anji", 23, "[email protected]", "somewhere"), ("mike", 32, "[email protected]", "elsewhere")]


class MyApp(App):

    CSS = """
    DataTable {
       height: 1fr;
    }
    """

    def __init__(self):
        super().__init__()
        self.table = DataTable(id="table", show_header=True)
        self.table.add_columns(*["name", "age", "email", "addr"])
        for row in DATA:
            self.table.add_row(*row)

    def compose(self):
        with TabbedContent('Basic', 'Advanced'):
            yield self.table
            yield Label("Here…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by anzhi0708
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #3123 on August 20, 2023 07:47.