Merge pull request #1874 from PySimpleGUI/Dev-latest

Added Table.Get as a dummy function as to match the new Get method in…
This commit is contained in:
PySimpleGUI 2019-08-24 18:29:48 -04:00 committed by GitHub
commit 38213f8c4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 5 deletions

View File

@ -4587,10 +4587,22 @@ class Table(Element):
if self.ParentForm.CurrentlyRunningMainloop:
self.ParentForm.TKroot.quit()
def Get(self):
"""
Dummy function for tkinter port. In the Qt port you can read back the values in the table in case they were
edited. Don't know yet how to enable editing of a Tree in tkinter so just returning the values provided by
user when Table was created or Updated.
:return: List[List[Any]] the current table values (for now what was originally provided up updated)
"""
return self.Values
set_focus = Element.SetFocus
set_tooltip = Element.SetTooltip
update = Update
get = Get
# ---------------------------------------------------------------------- #
# Tree #
@ -4755,11 +4767,11 @@ class Tree(Element):
self.TKTreeview.pack()
return self
set_focus = Element.SetFocus
set_tooltip = Element.SetTooltip
update = Update
class TreeData(object):
"""
Class that user fills in to represent their tree data. It's a very simple tree representation with a root "Node"
@ -8357,17 +8369,25 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
column_widths[i] = col_width
except:
column_widths[i] = col_width
if element.ColumnsToDisplay is None:
displaycolumns = element.ColumnHeadings if element.ColumnHeadings is not None else element.Values[0]
else:
displaycolumns = []
for i, should_display in enumerate(element.ColumnsToDisplay):
if should_display:
displaycolumns.append(element.ColumnHeadings[i])
column_headings = element.ColumnHeadings
if element.ColumnHeadings is not None:
displaycolumns.append(element.ColumnHeadings[i])
else:
displaycolumns.append(str(i))
column_headings = element.ColumnHeadings if element.ColumnHeadings is not None else displaycolumns
if element.DisplayRowNumbers: # if display row number, tack on the numbers to front of columns
displaycolumns = [element.RowHeaderText, ] + displaycolumns
column_headings = [element.RowHeaderText, ] + element.ColumnHeadings
if column_headings is not None:
column_headings = [element.RowHeaderText, ] + element.ColumnHeadings
else:
column_headings = [element.RowHeaderText, ] + displaycolumns
element.TKTreeview = element.Widget = ttk.Treeview(frame, columns=column_headings,
displaycolumns=displaycolumns, show='headings',
height=height,