Automatically Resize Command Line Window on Windows

Question:

I’m writing a program in Python, the data I want it to show must be able to fit on the screen at the same time without needing to scroll around. The default command line size does not allow for this.

Is there any way to automatically resize a command line window in Python without creating a GUI? The program will only be used on windows.

Asked By: Dan Doe

||

Answers:

Change the console size by right-clicking on console titlebar -> Properties -> Layout -> Window size

Answered By: user1227804
#!/usr/bin/env python3

import os

os.system('mode con: cols=100 lines=40')
input("Press any key to continue...")
Answered By: Fahri Güreşçi
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.