I'm using Win XP and Python 2.5. Is there a way in Python to modify font size when print to CMD window?
Asked
Active
Viewed 3.2k times
2
-
2Python knows nothing about the font: that's entirely down to Windows. Look for any options in the command prompt window. – Thomas K Jan 11 '11 at 16:11
-
possible duplicate of [Change console font in Windows](http://stackoverflow.com/questions/3592673/change-console-font-in-windows) – Ben Mar 30 '15 at 12:00
3 Answers
2
You can use ctypes
to access the necessary windows calls to change the font (including the size of the font) of the console. See my answer to another question for a code example.
0
You should create a desktop link to cmd.exe and set/change the layout properties (e.g. to window size 120*40 or appropriate). Start your program in this console windows (python.exe yourprogram.py).

B. Brosda
- 1
- 1
-4
No, you can't change that, as far as I know. Luckly, nobody on windows uses the console anyway, so I advise you to move to a GUI library instead.
With your own GUI window, you can configure the font and layout as much as you want, include buttons, images, animations, menus, etc...

nosklo
- 217,122
- 57
- 293
- 297
-
2"... nobody on windows uses the console anyway ..." - Hogwash! I use it, most programmers and other technical people I know who have to use Windows use it. I've even trained my (non-technical) wife to use it at times. Granted, the fraction of people who use it may be small ... – GreenMatt Jan 11 '11 at 19:15
-
@GreenMatt: Well, you're a programmer. If I had to use windows I'd install cygwin or something to have a real terminal. Windows console sucks - you have to admit it - it doesn't make a good tool and is more annoying than useful – nosklo Jan 11 '11 at 19:43
-
Granted, it's not the best, and I have Cygwin on my own systems. However, I generally don't have it available on systems belonging to family members, friends, etc. Also, some workplaces lock down their systems and won't install Cygwin. :-( – GreenMatt Jan 11 '11 at 21:32
-
@GreenMatt: You mean you often want to run your python code on a console window at your family member's computer? Come on, if that's the case, then building a GUI isn't that hard. – nosklo Jan 11 '11 at 23:24