(self, top, bottom, rows)
Scroll the region between top and bottom one row up (-) or down (+).
Scroll the region between top and bottom one row up (-) or down (+).
Scroll the region between top and bottom one row up ( - ) or down ( + ) .
def scroll(self, top, bottom, rows):
        """Scroll the region between top and bottom one row up (-) or down (+)."""
        if not rows:
            return
        # use zero-based indexing
        start, stop = top-1, bottom-1
        # we're using opposuite sign conventions
        csbi = GetConsoleScreenBufferInfo(self._hstdout)
        # absolute position of window in screen buffer
        # interpret other coordinates as relative to the window
        window = csbi.srWindow
        # scroll region
        clip_rect = wintypes.SMALL_RECT(
            window.Left, window.Top + start, window.Right, window.Top + stop
        )
        if rows < 0:
            # minus signs since rows is a negative number
            region = wintypes.SMALL_RECT(window.Left, window.Top - rows, window.Right, window.Bottom)
            new_pos = wintypes._COORD(window.Left, window.Top)
        else:
            region = wintypes.SMALL_RECT(window.Left, window.Top, window.Right, window.Bottom + rows)
            new_pos = wintypes._COORD(window.Left, window.Top + rows)
        # workaround: in this particular case, Windows doesn't seem to respect the clip area.
        if (
                clip_rect.Bottom == window.Bottom-1 and
                region.Bottom >= window.Bottom-1 and
                new_pos.Y < region.Top
            ):
            # first scroll everything up
            clip_rect.Bottom = window.Bottom
            bottom, region.Bottom = region.Bottom, window.Bottom
            ScrollConsoleScreenBuffer(self._hstdout, region, clip_rect, new_pos, u' ', self._attrs)
            # and then scroll the bottom back down
            new_pos.Y = window.Bottom
            region.Top = bottom-1
            ScrollConsoleScreenBuffer(self._hstdout, region, clip_rect, new_pos, u' ', self._attrs)
        else:
            ScrollConsoleScreenBuffer(self._hstdout, region, clip_rect, new_pos, u' ', self._attrs)
def scroll ( self , top , bottom , rows ) : if not rows : return # use zero-based indexing start , stop = top - 1 , bottom - 1 # we're using opposuite sign conventions csbi = GetConsoleScreenBufferInfo ( self . _hstdout ) # absolute position of window in screen buffer # interpret other coordinates as relative to the window window = csbi . srWindow # scroll region clip_rect = wintypes . SMALL_RECT ( window . Left , window . Top + start , window . Right , window . Top + stop ) if rows < 0 : # minus signs since rows is a negative number region = wintypes . SMALL_RECT ( window . Left , window . Top - rows , window . Right , window . Bottom ) new_pos = wintypes . _COORD ( window . Left , window . Top ) else : region = wintypes . SMALL_RECT ( window . Left , window . Top , window . Right , window . Bottom + rows ) new_pos = wintypes . _COORD ( window . Left , window . Top + rows ) # workaround: in this particular case, Windows doesn't seem to respect the clip area. if ( clip_rect . Bottom == window . Bottom - 1 and region . Bottom >= window . Bottom - 1 and new_pos . Y < region . Top ) : # first scroll everything up clip_rect . Bottom = window . Bottom bottom , region . Bottom = region . Bottom , window . Bottom ScrollConsoleScreenBuffer ( self . _hstdout , region , clip_rect , new_pos , u' ' , self . _attrs ) # and then scroll the bottom back down new_pos . Y = window . Bottom region . Top = bottom - 1 ScrollConsoleScreenBuffer ( self . _hstdout , region , clip_rect , new_pos , u' ' , self . _attrs ) else : ScrollConsoleScreenBuffer ( self . _hstdout , region , clip_rect , new_pos , u' ' , self . _attrs )