+ 4

In python how to get width and height of output console ???

Please give help, is that need sys module or another module please help

11th Sep 2018, 7:25 PM
Sousou
Sousou - avatar
2 odpowiedzi
+ 2
From doc puthon: 11.10.3. Querying the size of the output terminal shutil.get_terminal_size(fallback=(columns, lines)) Get the size of the terminal window. For each of the two dimensions, the environment variable, COLUMNS and LINES respectively, is checked. If the variable is defined and the value is a positive integer, it is used. When COLUMNS or LINES is not defined, which is the common case, the terminal connected to sys.__stdout__ is queried by invoking os.get_terminal_size(). If the terminal size cannot be successfully queried, either because the system doesn’t support querying, or because we are not connected to a terminal, the value given in fallback parameter is used. fallback defaults to (80, 24) which is the default size used by many terminal emulators. The value returned is a named tuple of type os.terminal_size.
16th Sep 2018, 9:44 AM
Александр
Александр - avatar
16th Sep 2018, 10:17 AM
Sousou
Sousou - avatar