add bind mouse wheell

This commit is contained in:
vincent 2018-08-22 15:01:03 +02:00
parent e2ab64172e
commit b25249cb29

View File

@ -54,6 +54,7 @@ class ScrollableCanvas(Frame):
# update the scrollbars to match the size of the inner frame # update the scrollbars to match the size of the inner frame
size = (interior.winfo_reqwidth(), interior.winfo_reqheight()) size = (interior.winfo_reqwidth(), interior.winfo_reqheight())
canvas.config(scrollregion="0 0 %s %s" % size) canvas.config(scrollregion="0 0 %s %s" % size)
canvas.yview_moveto(1)
if interior.winfo_reqwidth() != canvas.winfo_width(): if interior.winfo_reqwidth() != canvas.winfo_width():
# update the canvas's width to fit the inner frame # update the canvas's width to fit the inner frame
canvas.config(width=interior.winfo_reqwidth()) canvas.config(width=interior.winfo_reqwidth())
@ -65,6 +66,12 @@ class ScrollableCanvas(Frame):
canvas.itemconfigure(interior_id, width=canvas.winfo_width()) canvas.itemconfigure(interior_id, width=canvas.winfo_width())
canvas.bind('<Configure>', _configure_canvas) canvas.bind('<Configure>', _configure_canvas)
def _MouseWhell(event):
canvas.yview_scroll(-1*(event.delta/120), "units")
self.bind_all("<MouseWheel>",_MouseWhell)
class emmisionGUI(Frame): class emmisionGUI(Frame):
def __init__(self,parent,**kwarg): def __init__(self,parent,**kwarg):
Frame.__init__(self,parent) Frame.__init__(self,parent)