From 7b1f96e219b87ba868d12e7cb8ebe3b87153edf6 Mon Sep 17 00:00:00 2001 From: Urban Wallasch Date: Tue, 4 May 2021 13:08:36 +0200 Subject: [PATCH] * Fixed mousewheel scrolling partially not working by binding all relevant event handlers to container not canvas. * Use better looking scrollbar from tkinter.ttk. --- ffpreview.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/ffpreview.py b/ffpreview.py index ccba998..b06f9e3 100755 --- a/ffpreview.py +++ b/ffpreview.py @@ -58,6 +58,7 @@ import argparse import json from subprocess import PIPE, Popen from tkinter import * +from tkinter import ttk from inspect import currentframe @@ -322,7 +323,7 @@ container.pack(fill='both', expand=True) canvas = Canvas(container) canvas.pack(side='left', fill='both', expand=True) -scrollbar = Scrollbar(container, orient='vertical', command=canvas.yview) +scrollbar = ttk.Scrollbar(container, orient='vertical', command=canvas.yview) scrollbar.pack(side='right', fill='y') scrollframe = Frame(canvas) @@ -364,14 +365,14 @@ def unbind_mousewheel(event): canvas.unbind_all('') canvas.unbind_all('') -canvas.bind('', bind_mousewheel) -canvas.bind('', unbind_mousewheel) -canvas.bind_all('', mouse_wheel) # CursorUp key -canvas.bind_all('', mouse_wheel) # CursorDown key -canvas.bind_all('', home_end_scroll) # Home key -canvas.bind_all('', home_end_scroll) # End key -canvas.bind_all('', page_scroll) # PageUp key -canvas.bind_all('', page_scroll) # PageDn key +container.bind_all('', bind_mousewheel) +container.bind_all('', unbind_mousewheel) +container.bind_all('', mouse_wheel) # CursorUp key +container.bind_all('', mouse_wheel) # CursorDown key +container.bind_all('', home_end_scroll) # Home key +container.bind_all('', home_end_scroll) # End key +container.bind_all('', page_scroll) # PageUp key +container.bind_all('', page_scroll) # PageDn key ############################################################ -- 2.30.2