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:
		
						commit
						38213f8c4e
					
				
					 1 changed files with 25 additions and 5 deletions
				
			
		|  | @ -4587,10 +4587,22 @@ class Table(Element): | ||||||
|             if self.ParentForm.CurrentlyRunningMainloop: |             if self.ParentForm.CurrentlyRunningMainloop: | ||||||
|                 self.ParentForm.TKroot.quit() |                 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_focus = Element.SetFocus | ||||||
|     set_tooltip = Element.SetTooltip |     set_tooltip = Element.SetTooltip | ||||||
|     update = Update |     update = Update | ||||||
| 
 |     get = Get | ||||||
| 
 | 
 | ||||||
| # ---------------------------------------------------------------------- # | # ---------------------------------------------------------------------- # | ||||||
| #                           Tree                                         # | #                           Tree                                         # | ||||||
|  | @ -4755,11 +4767,11 @@ class Tree(Element): | ||||||
|             self.TKTreeview.pack() |             self.TKTreeview.pack() | ||||||
|         return self |         return self | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|     set_focus = Element.SetFocus |     set_focus = Element.SetFocus | ||||||
|     set_tooltip = Element.SetTooltip |     set_tooltip = Element.SetTooltip | ||||||
|     update = Update |     update = Update | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| class TreeData(object): | class TreeData(object): | ||||||
|     """ |     """ | ||||||
|     Class that user fills in to represent their tree data. It's a very simple tree representation with a root "Node" |     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 |                                 column_widths[i] = col_width | ||||||
|                         except: |                         except: | ||||||
|                             column_widths[i] = col_width |                             column_widths[i] = col_width | ||||||
|  | 
 | ||||||
|                 if element.ColumnsToDisplay is None: |                 if element.ColumnsToDisplay is None: | ||||||
|                     displaycolumns = element.ColumnHeadings if element.ColumnHeadings is not None else element.Values[0] |                     displaycolumns = element.ColumnHeadings if element.ColumnHeadings is not None else element.Values[0] | ||||||
|                 else: |                 else: | ||||||
|                     displaycolumns = [] |                     displaycolumns = [] | ||||||
|                     for i, should_display in enumerate(element.ColumnsToDisplay): |                     for i, should_display in enumerate(element.ColumnsToDisplay): | ||||||
|                         if should_display: |                         if should_display: | ||||||
|  |                             if element.ColumnHeadings is not None: | ||||||
|                                 displaycolumns.append(element.ColumnHeadings[i]) |                                 displaycolumns.append(element.ColumnHeadings[i]) | ||||||
|                 column_headings = element.ColumnHeadings |                             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 |                 if element.DisplayRowNumbers:  # if display row number, tack on the numbers to front of columns | ||||||
|                     displaycolumns = [element.RowHeaderText, ] + displaycolumns |                     displaycolumns = [element.RowHeaderText, ] + displaycolumns | ||||||
|  |                     if column_headings is not None: | ||||||
|                         column_headings = [element.RowHeaderText, ] + element.ColumnHeadings |                         column_headings = [element.RowHeaderText, ] + element.ColumnHeadings | ||||||
|  |                     else: | ||||||
|  |                         column_headings = [element.RowHeaderText, ] + displaycolumns | ||||||
|                 element.TKTreeview = element.Widget = ttk.Treeview(frame, columns=column_headings, |                 element.TKTreeview = element.Widget = ttk.Treeview(frame, columns=column_headings, | ||||||
|                                                                    displaycolumns=displaycolumns, show='headings', |                                                                    displaycolumns=displaycolumns, show='headings', | ||||||
|                                                                    height=height, |                                                                    height=height, | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue