Created
November 11, 2024 15:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TestNodes { | |
align: center middle; | |
} | |
#datatable { | |
height: 50%; | |
} | |
#remote_button, #tab-help-button { | |
background: green; | |
align: center middle; | |
} | |
#button-row { | |
align: center middle; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from textual.app import App, ComposeResult | |
from textual.containers import Center, Horizontal, Vertical | |
from textual.widgets import Button, DataTable, Footer | |
class Test(App): | |
CSS_PATH = "datatable_test.tcss" | |
def compose(self) -> ComposeResult: | |
""" | |
Create the user interface | |
""" | |
yield Vertical( | |
DataTable(id="datatable"), | |
Center( | |
Horizontal( | |
Button("Remote Desktop", variant="primary", id="remote_button"), | |
Button("Report Issue", variant="error", id="report_button"), | |
id="button-row" | |
) | |
), | |
id="main_tab" | |
) | |
yield Footer() | |
def on_mount(self) -> None: | |
ROWS = [("No Data Found", "", ""), ("Press CTRL+L to load CSV file", "", "")] | |
table = self.query_one(DataTable) | |
table.add_columns(*ROWS[0]) | |
table.add_rows(ROWS[1:]) | |
app = Test() | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment