From 5149a2c2a643d3aeab357fe11c023a86f560177f Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 21 Aug 2019 19:44:30 -0400 Subject: [PATCH 1/2] Added Table.Get method --- PySimpleGUIQt/PySimpleGUIQt.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/PySimpleGUIQt/PySimpleGUIQt.py b/PySimpleGUIQt/PySimpleGUIQt.py index 2e463e51..07c62758 100644 --- a/PySimpleGUIQt/PySimpleGUIQt.py +++ b/PySimpleGUIQt/PySimpleGUIQt.py @@ -2700,7 +2700,18 @@ class Table(Element): super().Update(self.QT_TableWidget, visible=visible) + def Get(self): + num_rows = self.QT_TableWidget.rowCount() + num_cols = self.QT_TableWidget.columnCount() + table = [[]] + for row in range(num_rows): + row_list = [] + for col in range(num_cols): + item = self.QT_TableWidget.item(row, col).text() + row_list.append(item) + table.append(row_list) + return table def treeview_selected(self, event): if self.ChangeSubmits: From 5227126ef1f0b6cc8af46bcfb3ef46359a514c80 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 21 Aug 2019 19:45:18 -0400 Subject: [PATCH 2/2] Fix in Get --- PySimpleGUIQt/PySimpleGUIQt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PySimpleGUIQt/PySimpleGUIQt.py b/PySimpleGUIQt/PySimpleGUIQt.py index 07c62758..f92cda80 100644 --- a/PySimpleGUIQt/PySimpleGUIQt.py +++ b/PySimpleGUIQt/PySimpleGUIQt.py @@ -2703,7 +2703,7 @@ class Table(Element): def Get(self): num_rows = self.QT_TableWidget.rowCount() num_cols = self.QT_TableWidget.columnCount() - table = [[]] + table = [] for row in range(num_rows): row_list = [] for col in range(num_cols):