Python 打印到屏幕时修改字体大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4658355/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Modify font size when print out to screen
提问by maximus
I'm using Win XP and Python 2.5. Is there a way in Python to modify font size when print to CMD window?
我使用的是 Win XP 和 Python 2.5。打印到 CMD 窗口时,Python 中有没有办法修改字体大小?
回答by nosklo
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.
不,据我所知,你不能改变这一点。幸运的是,无论如何 Windows 上都没有人使用控制台,因此我建议您改用 GUI 库。
With your own GUI window, you can configure the font and layout as much as you want, include buttons, images, animations, menus, etc...
使用您自己的 GUI 窗口,您可以根据需要配置字体和布局,包括按钮、图像、动画、菜单等...
回答by Marfisa
You can use ctypesto access the necessary windows calls to change the font (including the size of the font) of the console. See my answer to another questionfor a code example.
您可以使用ctypes访问必要的 windows 调用来更改控制台的字体(包括字体大小)。有关代码示例,请参阅我对另一个问题的回答。
回答by B. Brosda
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).
您应该创建一个指向 cmd.exe 的桌面链接并设置/更改布局属性(例如,窗口大小为 120*40 或适当)。在此控制台窗口中启动您的程序 (python.exe yourprogram.py)。

