From 156f6b3e0f8b1f3c4c4b0c890600fd639ec00f12 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 10 Nov 2018 17:32:24 -0500 Subject: [PATCH] Update the contents of Table Element --- PySimpleGUIQt/PySimpleGUIQt.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/PySimpleGUIQt/PySimpleGUIQt.py b/PySimpleGUIQt/PySimpleGUIQt.py index d5475aba..e74a6e88 100644 --- a/PySimpleGUIQt/PySimpleGUIQt.py +++ b/PySimpleGUIQt/PySimpleGUIQt.py @@ -2237,7 +2237,7 @@ class Table(Element): def QtCallbackCellActivated(self, value=None): - print('CELL ACTIVATED ', value) + # print('CELL ACTIVATED ', value) # first, get the results table built # modify the Results table in the parent FlexForm object if not self.ChangeSubmits: @@ -2253,6 +2253,13 @@ class Table(Element): if values is not None: self.Values = values self.SelectedRows = [] + self.QT_TableWidget.clear() + self.QT_TableWidget.setRowCount(len(self.Values)) + self.QT_TableWidget.setColumnCount(len(self.Values[0])) + for rownum, rows in enumerate(self.Values): + # self.QT_TableWidget.insertRow(rownum) + for colnum, columns in enumerate(rows): + self.QT_TableWidget.setItem(rownum, colnum, QTableWidgetItem(self.Values[rownum][colnum])) def treeview_selected(self, event): if self.ChangeSubmits: @@ -4152,8 +4159,6 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win): # element.QT_TableWidget.itemActivated.connect(element.QtCallbackCellActivated) # element.QT_TableWidget.itemEntered.connect(element.QtCallbackCellActivated) element.QT_TableWidget.itemSelectionChanged.connect(element.QtCallbackCellActivated) - # QObject::connect(ui->table->verticalHeader(), SIGNAL(sectionDoubleClicked(int)), this, SLOT( termSelect(int))); - # element.QT_TableWidget.verticalHeader().connect(element.QtCallbackVerticalHeader) element.QT_TableWidget.setRowCount(len(element.Values)) element.QT_TableWidget.setColumnCount(len(element.Values[0])) for rownum, rows in enumerate(element.Values):