MCPcopy Index your code
hub / github.com/python/cpython / getheightwidth

Method getheightwidth

Lib/_pyrepl/windows_console.py:388–397  ·  view source on GitHub ↗

Return (height, width) where height and width are the height and width of the terminal window in characters.

(self)

Source from the content-addressed store, hash-verified

386 self._hide_cursor()
387
388 def getheightwidth(self) -> tuple[int, int]:
389 """Return (height, width) where height and width are the height
390 and width of the terminal window in characters."""
391 info = CONSOLE_SCREEN_BUFFER_INFO()
392 if not GetConsoleScreenBufferInfo(OutHandle, info):
393 raise WinError(get_last_error())
394 return (
395 info.srWindow.Bottom - info.srWindow.Top + 1,
396 info.srWindow.Right - info.srWindow.Left + 1,
397 )
398
399 def _getscrollbacksize(self) -> int:
400 info = CONSOLE_SCREEN_BUFFER_INFO()

Callers 2

_scrollMethod · 0.95
prepareMethod · 0.95

Calls 3

WinErrorFunction · 0.90
get_last_errorFunction · 0.85

Tested by

no test coverage detected