mousewheel

tkinter canvas with mousewheel

tkinter canvas with mousewheel Question: I’m trying to make a canvas scrollable with a mousewheel. I tried this to see if I could at least print something with the action of the mousewheel: from tkinter import * from tkinter import ttk import platform class MainWindow: def __init__(self): self.metrics = [] self.content = ttk.Frame(root) self.content.grid_rowconfigure(0, weight …

Total answers: 1

tkinter: binding mousewheel to scrollbar

tkinter: binding mousewheel to scrollbar Question: I have this scroll-able frame (frame inside canvas actually). import Tkinter as tk class Scrollbarframe(): def __init__(self, parent,xsize,ysize,xcod,ycod): def ScrollAll(event): canvas1.configure(scrollregion=canvas1.bbox(“all”),width=xsize,height=ysize,bg=’white’) self.parent=parent self.frame1=tk.Frame(parent,bg=’white’) self.frame1.place(x=xcod,y=ycod) canvas1=tk.Canvas(self.frame1) self.frame2=tk.Frame(canvas1,bg=’white’,relief=’groove’,bd=1,width=1230,height=430) scrollbar1=tk.Scrollbar(self.frame1,orient=”vertical”,command=canvas1.yview) canvas1.configure(yscrollcommand=scrollbar1.set) scrollbar1.pack(side=”right”,fill=”y”) canvas1.pack(side=”left”) canvas1.create_window((0,0),window=self.frame2,anchor=’nw’) self.frame2.bind(“<Configure>”,ScrollAll) I would like to bind mouse wheel to the scrollbar so that user can scroll down the …

Total answers: 7