From 48530f123bc0efd314e8efe5876837cc82e65a49 Mon Sep 17 00:00:00 2001 From: PySimpleGUI Date: Thu, 29 Apr 2021 16:20:38 -0400 Subject: [PATCH] Fix for scrollable column still scrolling despite contents being smaller than what should require scrollbars --- DemoPrograms/Demo_OpenCV_4_Line_Program.py | 4 ++-- PySimpleGUI.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/DemoPrograms/Demo_OpenCV_4_Line_Program.py b/DemoPrograms/Demo_OpenCV_4_Line_Program.py index 6430fb06..96f715bb 100644 --- a/DemoPrograms/Demo_OpenCV_4_Line_Program.py +++ b/DemoPrograms/Demo_OpenCV_4_Line_Program.py @@ -1,4 +1,4 @@ import cv2, PySimpleGUI as sg -window, cap = sg.Window('Demo Application - OpenCV Integration', [[sg.Image(filename='', key='image')], ], location=(800, 400)), cv2.VideoCapture(0) +window, cap = sg.Window('Demo Application - OpenCV Integration', [[sg.Image(key='-IMAGE-')], ], location=(800, 400)), cv2.VideoCapture(0) while window(timeout=20)[0] is not None: - window['image'](data=cv2.imencode('.png', cap.read()[1])[1].tobytes()) + window['-IMAGE-'](data=cv2.imencode('.png', cap.read()[1])[1].tobytes()) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index b7c944b4..f55d8b64 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1,5 +1,5 @@ #!/usr/bin/python3 -version = __version__ = "4.40.0 Released 26-Apr-2021" +version = __version__ = "4.40.0.1 Unreleased\nFix for scrollable Column showing can be scrolled when the contents are actually smaller" __version__ = version.split()[0] # For PEP 396 and PEP 345 @@ -6283,6 +6283,8 @@ class TkScrollableFrame(tk.Frame): self.canvas.itemconfig(self.frame_id, height=e.height, width=e.width) def yscroll(self, event): + if self.canvas.yview() == (0.0, 1.0): + return if event.num == 5 or event.delta < 0: self.canvas.yview_scroll(1, "unit") elif event.num == 4 or event.delta > 0: