📜  python 设置终端大小 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:52.326000             🧑  作者: Mango

代码示例2
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()