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\'
Well, I haven't dig deep enough to be able to choose font by name (and I doubt it is possible), but this code (provided that pywin32 is installed) seems to do something funny with it's console (must be cmd.exe, Console2 doesn't work, I don't know if it works with powershell):
[C:Users/cji]|1> import win32console
[C:Users/cji]|2> win32console.PyConsoleScreenBufferType( win32console.GetStdHandle( win32console.STD_OUTPUT_HANDLE ) )
<2>
[C:Users/cji]|3> p = _
[C:Users/cji]|6> p.SetConsoleFont( 1 )
[C:Users/cji]|7> p.SetConsoleFont( 2 )
# and so on, to:
[C:Users/cji]|12> p.SetConsoleFont( 11 ) #this is Lucida Console, if I see correctly
Documentation says, that SetConsoleFont
"is not documented on MSDN"... But, it certainly does something with current console font, so I think you should search in this direction.
Also, similar question: How can I change console font?