(self, height, width)
Resize terminal.
Resize terminal.
Resize terminal .
def resize(self, height, width):
        """Resize terminal."""
        csbi = GetConsoleScreenBufferInfo(self._hstdout)
        # SetConsoleScreenBufferSize can't make the buffer smaller than the window
        # SetConsoleWindowInfo can't make the window larger than the buffer (in either direction)
        # allow for both shrinking and growing by calling one of them twice,
        # for each direction separately
        new_size = wintypes._COORD(width, csbi.dwSize.Y)
        new_window = wintypes.SMALL_RECT(0, 0, width-1, csbi.dwSize.Y-1)
        _SetConsoleScreenBufferSize(self._hstdout, new_size)
        _SetConsoleWindowInfo(self._hstdout, True, new_window)
        _SetConsoleScreenBufferSize(self._hstdout, new_size)
        new_size = wintypes._COORD(width, height)
        new_window = wintypes.SMALL_RECT(0, 0, width-1, height-1)
        _SetConsoleScreenBufferSize(self._hstdout, new_size)
        _SetConsoleWindowInfo(self._hstdout, True, new_window)
        _SetConsoleScreenBufferSize(self._hstdout, new_size)
def resize ( self , height , width ) : csbi = GetConsoleScreenBufferInfo ( self . _hstdout ) # SetConsoleScreenBufferSize can't make the buffer smaller than the window # SetConsoleWindowInfo can't make the window larger than the buffer (in either direction) # allow for both shrinking and growing by calling one of them twice, # for each direction separately new_size = wintypes . _COORD ( width , csbi . dwSize . Y ) new_window = wintypes . SMALL_RECT ( 0 , 0 , width - 1 , csbi . dwSize . Y - 1 ) _SetConsoleScreenBufferSize ( self . _hstdout , new_size ) _SetConsoleWindowInfo ( self . _hstdout , True , new_window ) _SetConsoleScreenBufferSize ( self . _hstdout , new_size ) new_size = wintypes . _COORD ( width , height ) new_window = wintypes . SMALL_RECT ( 0 , 0 , width - 1 , height - 1 ) _SetConsoleScreenBufferSize ( self . _hstdout , new_size ) _SetConsoleWindowInfo ( self . _hstdout , True , new_window ) _SetConsoleScreenBufferSize ( self . _hstdout , new_size )