Fix for scrollable column still scrolling despite contents being smaller than what should require scrollbars

This commit is contained in:
PySimpleGUI 2021-04-29 16:20:38 -04:00
parent 5625d536cf
commit 48530f123b
2 changed files with 5 additions and 3 deletions

View File

@ -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())

View File

@ -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: