code: def _calc_scrollbars(self, viewer, whence):
          
          if self._scrolling or whence > 0:
              return
  
          # flag that suppresses a cyclical callback
          self._adjusting = True
          try:
              bd = self.viewer.get_bindings()
              res = bd.calc_pan_pct(self.viewer, pad=self.pad)
              if res is None:
                  return
  
              page_x, page_y = (float(res.thm_pct_x * 100),
                                float(res.thm_pct_y * 100))
              self.rng_x, self.rng_y = 100 - page_x, 100 - page_y
              val_x, val_y = (float(res.pan_pct_x * self.rng_x),
                              float((1.0 - res.pan_pct_y) * self.rng_y))
  
              upper_x, upper_y = 100.0, 100.0
  
              adj = self.hsb.get_adjustment()
              adj.configure(val_x, 0.0, upper_x, 1.0, page_x, page_x)
              self.hsb.set_adjustment(adj)
              adj = self.vsb.get_adjustment()
              adj.configure(val_y, 0.0, upper_y, 1.0, page_y, page_y)
              self.vsb.set_adjustment(adj)
  
          finally:
              self._adjusting = False
          return True
docs: Calculate and set the scrollbar handles from the pan and
          zoom positions.