code: def offset(self):
          
          vsb = self.editor.verticalScrollBar()
          style = vsb.style()
          opt = QStyleOptionSlider()
          vsb.initStyleOption(opt)
  
          # Get the area in which the slider handle may move.
          groove_rect = style.subControlRect(
                  QStyle.CC_ScrollBar, opt, QStyle.SC_ScrollBarGroove, self)
  
          return groove_rect.y()
docs: This property holds the vertical offset of the scroll flag area
          relative to the top of the text editor.