User Tools

Site Tools


python_terminalsize

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

python_terminalsize [2024/05/31 13:33] – created walterpython_terminalsize [2024/05/31 13:36] (current) walter
Line 1: Line 1:
 ====== Terminalgröße bestimmen ====== ====== Terminalgröße bestimmen ======
  
 +<code python>
 +import shutil
 +breite, hoehe = shutil.get_terminal_size()
 +print(breite)
 +print(hoehe)
  
 +size = shutil.get_terminal_size()
 +print(size.columns, size.lines)
 +</code>
  
->>> import shutil +Output
->>> shutil.get_terminal_size() +<code bash
-os.terminal_size(columns=160, lines=9) +140 
- +35 
-The output that we see is a named tuple, so we can use it in multiple ways+14035 
- +</code>
->>> size = shutil.get_terminal_size() +
->>> size.columns +
-160 +
->>> widthheight = size +
->>> width +
-160 +
->>> height +
-9+
python_terminalsize.txt · Last modified: 2024/05/31 13:36 by walter