def yview(self, *args): ## callback for vertscrollbar_command # args can be ('scroll', number, type) where type is page or unit # or ('moveto', '0.2854982') #print args if args[0] == "scroll": # ('scroll', '1', 'pages') when click on back of bar # ('scroll', '1', 'units') when click on bar arrow self.yview_scroll(args[1], args[2]) else: # ('moveto', '0.350939') when dragging bar percent = float(args[1]) line = int(self.nbLines * float(percent)) #print 'GAGA', line, self.firstVisibleNodeLineNum if self.firstVisibleNodeLineNum != line: v = self.scrollView(line - self.firstVisibleNodeLineNum) if v: # compute percentage of motion total = self.nbLines + (self.headerHeight / float(self.nodeHeight)) percent = self.firstVisibleNodeLineNum / total ScrolledCanvas.yview_moveto(self, percent) self.redraw() self.redrawHeader(args)
def yview(self, *args): ## callback for vertscrollbar_command # args can be ('scroll', number, type) where type is page or unit # or ('moveto', '0.2854982') #print args if args[0] == "scroll": # ('scroll', '1', 'pages') when click on back of bar # ('scroll', '1', 'units') when click on bar arrow self.yview_scroll(args[1], args[2]) else: # ('moveto', '0.350939') when dragging bar percent = float(args[1]) line = int(self.nbLines * float(percent)) #print 'GAGA', line, self.firstVisibleNodeLineNum if self.firstVisibleNodeLineNum != line: v = self.scrollView(line - self.firstVisibleNodeLineNum) if v: # compute percentage of motion total = self.nbLines+(self.headerHeight/float(self.nodeHeight)) percent = self.firstVisibleNodeLineNum/total ScrolledCanvas.yview_moveto(self, percent) self.redraw() self.redrawHeader(args)