'Scroll the window by the indicated number of lines.'

def scroll_window(self, lines):

    info = CONSOLE_SCREEN_BUFFER_INFO()
    self.GetConsoleScreenBufferInfo(self.hout, byref(info))
    rect = info.srWindow
    log(('sw:    rtop=%d    rbot=%d' % (rect.Top, rect.Bottom)))
    top = (rect.Top + lines)
    bot = (rect.Bottom + lines)
    h = (bot - top)
    maxbot = (info.dwSize.Y - 1)
    if (top < 0):
        top = 0
        bot = h
    if (bot > maxbot):
        bot = maxbot
        top = (bot - h)
    nrect = SMALL_RECT()
    nrect.Top = top
    nrect.Bottom = bot
    nrect.Left = rect.Left
    nrect.Right = rect.Right
    log(('sn:    top=%d    bot=%d' % (top, bot)))
    r = self.SetConsoleWindowInfo(self.hout, True, byref(nrect))
    log(('r=%d' % r))
