File: data_table_null_mixed_cols.py

package info (click to toggle)
textual-fastdatatable 0.12.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,856 kB
  • sloc: python: 3,461; makefile: 24
file content (22 lines) | stat: -rw-r--r-- 643 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from textual.app import App, ComposeResult
from textual_fastdatatable import ArrowBackend, DataTable

ROWS = [
    ("lane", "swimmer", "country", "time"),
    (3, "Li Zhuhao", "China", 51.26),
    ("eight", None, "France", 51.58),
    ("seven", "Tom Shields", "United States", None),
    (1, "Aleksandr Sadovnikov", "Russia", 51.84),
    (None, "Darren Burns", "Scotland", 51.84),
]


class TableApp(App):
    def compose(self) -> ComposeResult:
        backend = ArrowBackend.from_records(ROWS, has_header=True)
        yield DataTable(backend=backend, null_rep="[dim]∅ null[/]")


app = TableApp()
if __name__ == "__main__":
    app.run()