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 :: remove column from df 
Python :: import seaborn 
Python :: cv2.cvtcolor grayscale 
Python :: how to print time python 3 
Python :: python check if file exists 
Python :: python reload lib jupyter notebook %reload 
Python :: python get location of script 
Python :: create conda env with specific python version 
Python :: python delay 
Python :: clear_output jupyter 
Python :: round python with list 
Python :: pylsp install 
Python :: python format seconds to hh mm ss 
Python :: pandas get rows with missing data 
Python :: running selenium on google colab 
Python :: how to save and load model in keras 
Python :: create dictionary python from two lists 
Python :: python date add days 
Python :: add picture to jupyter notebook 
Python :: extended euclidean python 
Python :: hide window in selenium Webdriver python 
Python :: python reload function in shell 
Python :: python euclidean algorithm 
Python :: open link from python 
Python :: python selenium select dropdown 
Python :: python flask sample application 
Python :: write to txt python 
Python :: choice random word in python from a text file 
Python :: classification report scikit 
Python :: autoslugfield django 3 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =