def update(self):
        """
        Draw the scroll bar.
        """
        # Sort out chars
        cursor = u"█" if self._canvas.unicode_aware else "O"
        back = u"░" if self._canvas.unicode_aware else "|"

        # Now draw...
        try:
            sb_pos = self._get_pos()
            sb_pos = min(1, max(0, sb_pos))
            sb_pos = max(int(self._height * sb_pos) - 1, 0)
        except ZeroDivisionError:
            sb_pos = 0
        (colour, attr, bg) = self._palette["scroll"]
        y = self._canvas.start_line if self._absolute else 0
        for dy in range(self._height):
            self._canvas.print_at(cursor if dy == sb_pos else back,
                                  self._x, y + self._y + dy,
                                  colour, attr, bg)
def update ( self ) : cursor = u"█" if self . _canvas . unicode_aware else "O" back = u"░" if self . _canvas . unicode_aware else "|" try : sb_pos = self . _get_pos ( ) sb_pos = min ( 1 , max ( 0 , sb_pos ) ) sb_pos = max ( int ( self . _height * sb_pos ) - 1 , 0 ) except ZeroDivisionError : sb_pos = 0 ( colour , attr , bg ) = self . _palette [ "scroll" ] y = self . _canvas . start_line if self . _absolute else 0 for dy in range ( self . _height ) : self . _canvas . print_at ( cursor if dy == sb_pos else back , self . _x , y + self . _y + dy , colour , attr , bg )
Draw the scroll bar.