13

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.

Al Sweigart
  • 11,566
  • 10
  • 64
  • 92
Dan Doe
  • 1,146
  • 3
  • 14
  • 25

2 Answers2

29
#!/usr/bin/env python3

import os

os.system('mode con: cols=100 lines=40')
input("Press any key to continue...")
Fahri Güreşçi
  • 569
  • 7
  • 14
-4

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

user1227804
  • 390
  • 1
  • 5
  • You can save the change in properties for all future console windows so they would open with the larger size. Also please see that question: http://stackoverflow.com/questions/190543/how-can-i-change-the-width-of-a-windows-console-window – user1227804 Feb 27 '12 at 01:57