From 577af38445b2ae7eb7fd933d8605e5d28f87d9cb Mon Sep 17 00:00:00 2001 From: PySimpleGUI Date: Sun, 8 May 2022 09:04:00 -0400 Subject: [PATCH] Fix for Scrollable Columns - wasn't scrolling correctly when Column expanded --- PySimpleGUI.py | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index b3afa871..f175c8a8 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1,6 +1,6 @@ #!/usr/bin/python3 -version = __version__ = "4.59.0.44 Released 5-Apr-2022" +version = __version__ = "4.59.0.45 Released 5-Apr-2022" _change_log = """ Changelog since 4.59.0 released to PyPI on 5-Apr-2022 @@ -147,6 +147,8 @@ _change_log = """ Hi-Ho-Hi-Ho... it's back to no file_type on the Mac we go... Need to add similar code to popup_get_file to ensure doesn't crash there too. 4.59.0.44 Fix in popup_get_file for the file_type parameter that crashes on the Mac. Like the Browse button, the file_type parameter is disabled for the Mac. VERY sorry Mac users + 4.59.0.45 + Fix for Scrollable Columns that expand. Needed to switch to using the canvas, not the frame, for scrolling (THANK YOU Jason and milahu!) """ __version__ = version.split()[0] # For PEP 396 and PEP 345 @@ -7784,34 +7786,35 @@ class TkScrollableFrame(tk.Frame): # Chr0nic + # self.unhookMouseWheel(None) + # self.TKFrame.bind("", self.hookMouseWheel) + # self.TKFrame.bind("", self.unhookMouseWheel) + # self.bind('', self.set_scrollregion) + + self.unhookMouseWheel(None) - self.TKFrame.bind("", self.hookMouseWheel) - self.TKFrame.bind("", self.unhookMouseWheel) - - # self.canvas.bind_all('<4>', self.yscroll, add='+') - # self.canvas.bind_all('<5>', self.yscroll, add='+') - # self.canvas.bind_all("", self.yscroll, add='+') - # self.canvas.bind_all("", self.xscroll, add='+') - + self.canvas.bind("", self.hookMouseWheel) + self.canvas.bind("", self.unhookMouseWheel) self.bind('', self.set_scrollregion) + # Chr0nic def hookMouseWheel(self, e): # print("enter") VarHolder.canvas_holder = self.canvas - self.TKFrame.bind_all('<4>', self.yscroll, add='+') - self.TKFrame.bind_all('<5>', self.yscroll, add='+') - self.TKFrame.bind_all("", self.yscroll, add='+') - self.TKFrame.bind_all("", self.xscroll, add='+') + self.canvas.bind_all('<4>', self.yscroll, add='+') + self.canvas.bind_all('<5>', self.yscroll, add='+') + self.canvas.bind_all("", self.yscroll, add='+') + self.canvas.bind_all("", self.xscroll, add='+') # Chr0nic def unhookMouseWheel(self, e): # print("leave") VarHolder.canvas_holder = None - self.TKFrame.unbind_all('<4>') - self.TKFrame.unbind_all('<5>') - self.TKFrame.unbind_all("") - self.TKFrame.unbind_all("") + self.canvas.unbind_all('<4>') + self.canvas.unbind_all('<5>') + self.canvas.unbind_all("") + self.canvas.unbind_all("") def resize_frame(self, e): self.canvas.itemconfig(self.frame_id, height=e.height, width=e.width) @@ -17607,7 +17610,7 @@ def easy_print(*args, size=(None, None), end=None, sep=None, location=(None, Non :type erase_all: (bool) :param blocking: if True, makes the window block instead of returning immediately. The "Quit" button changers to "More" :type blocking: (bool | None) - :param wait: Same as the "blocking" parm. It's an alias. if True, makes the window block instead of returning immediately. The "Quit" button changers to "More" + :param wait: Same as the "blocking" parm. It's an alias. if True, makes the window block instead of returning immediately. The "Quit" button changes to "Click to Continue..." :type wait: (bool | None) :return: :rtype: