diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 49161837..34d2f25d 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -3985,6 +3985,8 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form): element.TooltipObject = ToolTip(element.TKScale, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) # ------------------------- TABLE element ------------------------- # elif element_type == ELEM_TYPE_TABLE: + frame = tk.Frame(tk_row_frame) + height = element.NumRows if element.Justification == 'left': anchor = tk.W @@ -4012,7 +4014,7 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form): if element.DisplayRowNumbers: # if display row number, tack on the numbers to front of columns displaycolumns = ['Row',] + displaycolumns column_headings = ['Row',] + element.ColumnHeadings - element.TKTreeview = ttk.Treeview(tk_row_frame, columns=column_headings, + element.TKTreeview = ttk.Treeview(frame, columns=column_headings, displaycolumns=displaycolumns, show='headings', height=height, selectmode=element.SelectMode) treeview = element.TKTreeview if element.DisplayRowNumbers: @@ -4043,12 +4045,15 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form): # scrollable_frame.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1], expand=True, fill='both') treeview.bind("<>", element.treeview_selected) - scrollbar = tk.Scrollbar(tk_row_frame) + + + scrollbar = tk.Scrollbar(frame) scrollbar.pack(side=tk.RIGHT, fill='y') scrollbar.config(command=treeview.yview) treeview.configure(yscrollcommand=scrollbar.set) element.TKTreeview.pack(side=tk.LEFT,expand=True, padx=0, pady=0, fill='both') + frame.pack(side=tk.LEFT,expand=True, padx=0, pady=0, fill='both') if element.Tooltip is not None: element.TooltipObject = ToolTip(element.TKTreeview, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) # ------------------------- Tree element ------------------------- # diff --git a/PySimpleGUI27.py b/PySimpleGUI27.py index a4ef8fe8..3973c71d 100644 --- a/PySimpleGUI27.py +++ b/PySimpleGUI27.py @@ -1401,10 +1401,10 @@ class Image(Element): if filename is not None: image = tk.PhotoImage(file=filename) elif data is not None: - if type(data) is bytes: - image = tk.PhotoImage(data=data) - else: - image = data + # if type(data) is bytes: + image = tk.PhotoImage(data=data) + # else: + # image = data else: return width, height = image.width(), image.height() self.tktext_label.configure(image=image, width=width, height=height) @@ -2319,14 +2319,16 @@ class Table(Element): def Update(self, values=None): if values is not None: - self.TKTreeview.delete(*self.TKTreeview.get_children()) - for i, value in enumerate(self.Values): + children = self.TKTreeview.get_children() + for i in children: + self.TKTreeview.detach(i) + self.TKTreeview.delete(i) + children = self.TKTreeview.get_children() + # self.TKTreeview.delete(*self.TKTreeview.get_children()) + for i, value in enumerate(values): if self.DisplayRowNumbers: value = [i] + value - id = self.TKTreeview.insert('', 'end', text=value, values=value, tag=i % 2) - if i == 4: - break - + id = self.TKTreeview.insert('', 'end', text=i, iid=i+1, values=value, tag=i % 2) if self.AlternatingRowColor is not None: self.TKTreeview.tag_configure(1, background=self.AlternatingRowColor) self.Values = values @@ -2334,15 +2336,7 @@ class Table(Element): def treeview_selected(self, event): selections = self.TKTreeview.selection() - self.SelectedRows = [int(x[1:], 16)-1 for x in selections] - # ttk.Treeview.selection - # print(select) - # self.TKTreeview.TreeSelection.get_selected_rows() - # - # iid = self.TKTreeview.focus() - # # item = self.Values[iid] - # print('Selected item iid: %s' % iid) - # #self.process_directory(iid, path) + self.SelectedRows = [int(x)-1 for x in selections] def __del__(self): @@ -2672,6 +2666,10 @@ class Window(object): self.TimerCancelled = False self.TKAfterID = self.TKroot.after(timeout, self._TimeoutAlarmCallback) self.TKroot.mainloop() + try: + self.TKroot.after_cancel(self.TKAfterID) + except: + pass self.TimerCancelled = True if self.RootNeedsDestroying: self.TKroot.destroy() @@ -3437,7 +3435,7 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form): col_frame = tk.Frame(tk_row_frame) PackFormIntoFrame(element, col_frame, toplevel_form) - col_frame.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + col_frame.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1], expand=True, fill='both') if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None: col_frame.configure(background=element.BackgroundColor, highlightbackground=element.BackgroundColor, highlightcolor=element.BackgroundColor) # ------------------------- TEXT element ------------------------- # @@ -4047,7 +4045,7 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form): for i, value in enumerate(element.Values): if element.DisplayRowNumbers: value = [i] + value - id = treeview.insert('', 'end', text=value, values=value, tag=i%2) + id = treeview.insert('', 'end', text=value, iid=i+1, values=value, tag=i%2) if element.AlternatingRowColor is not None: treeview.tag_configure(1, background=element.AlternatingRowColor) if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: @@ -4057,6 +4055,11 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form): # scrollable_frame.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1], expand=True, fill='both') treeview.bind("<>", element.treeview_selected) + scrollbar = tk.Scrollbar(tk_row_frame) + scrollbar.pack(side=tk.RIGHT, fill='y') + scrollbar.config(command=treeview.yview) + + treeview.configure(yscrollcommand=scrollbar.set) element.TKTreeview.pack(side=tk.LEFT,expand=True, padx=0, pady=0, fill='both') if element.Tooltip is not None: element.TooltipObject = ToolTip(element.TKTreeview, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) diff --git a/docs/index.md b/docs/index.md index ed127e12..68f09cfa 100644 --- a/docs/index.md +++ b/docs/index.md @@ -23,9 +23,9 @@ ## Now supports both Python 2.7 & 3 -![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3.x_Version-3.10.1-red.svg?longCache=true&style=for-the-badge) +![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3.x_Version-3.10.2-red.svg?longCache=true&style=for-the-badge) - ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_2.7_Version-1.2.1-blue.svg?longCache=true&style=for-the-badge) + ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_2.7_Version-1.2.2-blue.svg?longCache=true&style=for-the-badge) [Announcements of Latest Developments](https://github.com/MikeTheWatchGuy/PySimpleGUI/issues/142) @@ -3638,6 +3638,11 @@ It's official. There is a 2.7 version of PySimpleGUI! * Window.Minimize will minimize to taskbar * Button background color can be set to system default (i.e. not changed) +### 3.10.2 & 1.2.2 +Emergency patch release... going out same day as previous release +* The timeout timer for the new Read with timer wasn't being properly shut down +* The Image.Update method appears to not have been written correctly. It didn't handle base64 images like the other elements that deal with images (buttons) + ### Upcoming diff --git a/readme.md b/readme.md index ed127e12..68f09cfa 100644 --- a/readme.md +++ b/readme.md @@ -23,9 +23,9 @@ ## Now supports both Python 2.7 & 3 -![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3.x_Version-3.10.1-red.svg?longCache=true&style=for-the-badge) +![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3.x_Version-3.10.2-red.svg?longCache=true&style=for-the-badge) - ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_2.7_Version-1.2.1-blue.svg?longCache=true&style=for-the-badge) + ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_2.7_Version-1.2.2-blue.svg?longCache=true&style=for-the-badge) [Announcements of Latest Developments](https://github.com/MikeTheWatchGuy/PySimpleGUI/issues/142) @@ -3638,6 +3638,11 @@ It's official. There is a 2.7 version of PySimpleGUI! * Window.Minimize will minimize to taskbar * Button background color can be set to system default (i.e. not changed) +### 3.10.2 & 1.2.2 +Emergency patch release... going out same day as previous release +* The timeout timer for the new Read with timer wasn't being properly shut down +* The Image.Update method appears to not have been written correctly. It didn't handle base64 images like the other elements that deal with images (buttons) + ### Upcoming