Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

get terminal size python

import os

# you can do like this
columns, lines = os.get_terminal_size()

# or 
size = os.get_terminal_size()

columns = size.columns
lines = size.lines
Comment

python set terminal size

If you install xdotool, you can change the size of the terminal window with something like this:

import subprocess
import shlex

id_cmd='xdotool getactivewindow'
resize_cmd='xdotool windowsize --usehints {id} 100 30'

proc=subprocess.Popen(shlex.split(id_cmd),stdout=subprocess.PIPE)
windowid,err=proc.communicate()
proc=subprocess.Popen(shlex.split(resize_cmd.format(id=windowid)))
proc.communicate()
Comment

PREVIOUS NEXT
Code Example
Python :: print value of array python 
Python :: python replace in string 
Python :: accumulator programming python 
Python :: with function python 
Python :: Python NumPy asfarray Function Example Tuple to float type array 
Python :: get second min no from array in python 
Python :: python generator function 
Python :: set pop in python 
Python :: how to make python script run forever 
Python :: how to put my graph in tkinter interface 
Python :: Setting spacing (minor) between ticks in matplotlib 
Python :: request.args.get check if defined 
Python :: xlrd python read excel 
Python :: format number differences in python 
Python :: pickle dump example 
Python :: reactstrap example 
Python :: type() function in python 
Python :: how to pre populate field flask wtforms 
Python :: python - match two df on a variable with different name 
Python :: generative art python 
Python :: py search and get objects from array 
Python :: var colors python 
Python :: loop through dataframe rows python 
Python :: string in python 
Python :: how to make a square in python 
Python :: remove element from list python by value 
Python :: pip install 
Python :: insert an element in list python 
Python :: Split a list based on a condition 
Python :: cv2 videowriter python not working 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =