Dan Doe
Dan Doe

Reputation: 1156

Automatically Resize Command Line Window on Windows

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.

Upvotes: 14

Views: 23554

Answers (2)

#!/usr/bin/env python3

import os

os.system('mode con: cols=100 lines=40')
input("Press any key to continue...")

Upvotes: 30

user1227804
user1227804

Reputation: 390

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

Upvotes: -4

Related Questions