from textual.app import App, ComposeResult from textual.widgets import DataTable import otime import file_io from pdf import format_m_s global ROWS class TableApp(App): def compose(self) -> ComposeResult: yield DataTable() def on_mount(self) -> None: global ROWS table = self.query_one(DataTable) table.add_columns(*ROWS[0]) table.add_rows(ROWS[1:]) def main(path): event = file_io.event_from_yaml_and_csv(path + '/config.yaml', path + '/mtr.yaml', path + '/runners.csv') result = event.get_result() global ROWS ROWS = [] for o_class in result: ROWS += [(str(i.id), str(i.place), i.fullname(), i.o_class, i.club, str(i.card_id), format_m_s(i.total_time), str(i.controls)) for i in o_class.runner_results] print(ROWS) app = TableApp() app.run() if __name__ == "__main__": main()