Resize terminal window with python.

Hey there people, I'm making a python lazy-script manager which asks the user for an input and executes the selected command on a terminal.The main menu greets the user with an ascii art text but unfortunately it gets spoiled if the window is too small,also some of commands have a better output if the terminal window is bigger than default. Is there any way that i could resize the terminal window through python when the user executes my script? Current OS:Linux Mint Tara

4th Sep 2018, 11:28 PM
Thanos A.
Thanos A. - avatar
2 Answers
+ 2
I think I understand. You want the terminal to essentially become responsive to your program and auto size so the art is clearly visible. If that is the case the 'os' library can probably help. Try: from os import system system('mode con: cols=200 lines=49') Just update the integers to your desired size. The size I added looks best for my laptop. Best of luck.
4th Sep 2018, 11:45 PM
Steven M
Steven M - avatar
+ 1
That's exactly what i intended to do,i will give it a try soon.Thanks a lot.
4th Sep 2018, 11:48 PM
Thanos A.
Thanos A. - avatar