В чем проблема?
#!/usr/bin/python3 import tkinter as tk class Bug: def __init__(self,parent): self.parent = parent self.gui() def move_up(self,event=None,value=-1): self.cvs.yview_scroll(value,'units') def move_down(self,event=None,value=1): self.cvs.yview_scroll(value,'units') def bindings(self): self.parent.bind('<Down>',self.move_down) self.parent.bind('<Up>',self.move_up) def gui(self): self.frames() self.widgets() self.bindings() def frames(self): self.frm1 = tk.Frame(self.parent) self.frm1.pack(expand=1) def widgets(self): self.cvs = tk.Canvas(self.frm1) self.cvs.pack() self.lbl = tk.Label(self.frm1) self.lbl.pack(expand=1) self.cvs.create_window(0,0,window=self.lbl) def add_row(self,text): frm = tk.Frame(self.lbl) frm.pack() cbox = tk.Checkbutton(frm) cbox.pack(side='left') lbl = tk.Label(frm) lbl.config(text=text) lbl.pack(side='left') def fill(self): for i in range(100): self.add_row('Row %d' % i) def region (self,x=0,y=0 ,x_border=0,y_border=0 ): # Both integer and float values are allowed at input if x and y: self.cvs.configure (scrollregion = (-x/2 - x_border ,-y/2 - y_border , x/2 + x_border , y/2 + y_border ) ) else: print('Empty input is not allowed!') def scroll(self,event=None,x=0,y=0): self.cvs.xview_moveto(x) self.cvs.yview_moveto(y) if __name__ == '__main__': root = tk.Tk() root.geometry('400x300') bug = Bug(root) bug.fill() bug.region (x = 400 ,y = 2050 ,x_border = 5 ,y_border = 20 ) bug.scroll() root.wait_window() root.mainloop()