I can’t get my mousewheel-bind event to work, this is my code:
class Game(ctk.CTkToplevel):
def init(self, master=None):
global fråge_font
global alt_font
fråge_font = ctk.CTkFont(family = FONT1, size = FRÅGA_FONT, weight=”bold”)
alt_font = ctk.CTkFont(family = FONT1, size = FRÅGA_FONT)
super().init(master, fg_color=”grey15″)
self.title(“Guest Window”)
self.geometry(“0x0”)
self.state(“zoomed”)
#self.attributes(“-fullscreen”, True)
self.protocol("WM_DELETE_WINDOW", self.on_close)
self.bind("<Escape>", lambda event: self.quit())
self.ruta = {}
self.canvas = ctk.CTkCanvas(self)
self.scrollbar = ctk.CTkScrollbar(self, orientation="vertical", command=self.canvas.yview)
self.scrollable_frame = ctk.CTkFrame(self.canvas, fg_color="grey15")
self.canvas.bind("<Mousewheel>", lambda event: canvas.yview_scroll(int((event.delta/120)), "units"))
self.scrollable_frame_window = self.canvas.create_window((0, 0), window=self.scrollable_frame, anchor="nw")
self.canvas.configure(yscrollcommand=self.scrollbar.set)
self.canvas.pack(expand = True, fill= "both")
self.scrollbar.place(relx = 1, rely = 0.05, anchor = "ne", relheight= 0.9)
self.scrollable_frame.bind("<Configure>", self._on_frame_configure)
canvas = self.canvas
self.game_widgets()
I’ve tried to bind it to “scrollable_frame” too, but it won’t work. I’m on windows and use customtkinter