Change console font in Windows

后端 未结 7 1161
闹比i
闹比i 2020-11-30 12:04

Is there a way to change the console font in Windows in python 2.6?

I\'m on Windows 7.

ie:

import os
os.console.font = \'Lucida Console\'
         


        
7条回答
  •  星月不相逢
    2020-11-30 12:18

    I looked into the windows API: http://msdn.microsoft.com/en-us/library/ms682073%28v=VS.85%29.aspx

    It look like it has a function for changing the console font:

    SetCurrentConsoleFontEx
    

    or at least getting information about the current font:

    GetCurrentConsoleFont
    GetCurrentConsoleFontEx
    

    My next step was to find a python module that I can use the windows API. Here's one called pywin32: http://sourceforge.net/projects/pywin32/

    The actual modules you import are not called pywin32, but win32api, win32net, win32console I figured this out by complete guesswork. Where's the documentation? a run on help('win32console')

    DOESN'T show the mentioned font functions in there, it's just plain missing them. Am I missing something here? Where are the docs? Or where is a module that has all of the API's console functions...?

提交回复
热议问题