[Texas] Changing the font of the Console module
ragecreations at gmail.com
Tue Nov 25 16:04:37 CET 2008
On Sun, Nov 23, 2008 at 6:08 PM, Walker Hale IV <walker.hale.iv at gmail.com>wrote:
> Short Answer:
> Give up. You are so deep into Windows API nastiness that you can't see
> Long Answer:
> You can't do anything in Python that you can't do in C.
> Fredrik Lundh's Console module does not support setting the font. This
> module is mostly some C code that accesses a few of the console
> functions in Win32.
> Any deficiencies in this module might be overcome by calling Win32
> functions directly using either the ctypes module or using the pywin32
> In fact you could use either ctypes or pywin32 as a replacement for
> the Console module, but the API wouldn't be as nice.
> Now pywin32/win32console does not contain all of the functions in
> Win32. In particular, the one function for dealing with fonts is
> Microsoft discourages using custom fonts in consoles.
> The only way a font can appear in a console is if that font has been
> added to a magic spot in the registry. This makes the font available
> in the Properties page for the console (when you open the menu in the
> Theoretically, C code can set a console to use one of those specially
> registered fonts, but I haven't found any examples of people
> successfully doing it.
> Bottom Line:
> You are at the beginning of a long, hard road. Python will neither
> help nor hurt you. The problems you face are the same as for a C
> If you still want to attempt this you will need to:
> * Add your font to the magic spot in the registry, giving it a number.
> * Verify that you can use that font in a standard console window by
> selecting it in the properties dialog.
> * Write special code using ctypes to
> ** create a new console buffer
> ** set the font number for the buffer to the corresponding font number
> in the registry using SetCurrentConsoleFontEx
> ** install the new buffer into your console
> Or something like that. And it still might not work!
> Walker Hale <walker.hale.iv at gmail.com>
> On Fri, Nov 21, 2008 at 9:58 PM, Rage Creation <ragecreations at gmail.com>
> > Using the Console module as described here:
> > http://effbot.org/zone/console-handbook.htm
> > Is there a way to change the system font so that all fonts used within
> > program follow that?
> > Or a way to modify the Console module to adjust what font its using (it
> > to be reading a font from somewhere, right?)
> > Thanks,
> > Anthony
> > On Thu, Nov 20, 2008 at 11:06 AM, Walker Hale IV <
> walker.hale.iv at gmail.com>
> > wrote:
> >> Are you referring to the console module for Jython or something else?
> >> In general, adding an attribute that does not already exist to a
> >> module will have no effect.
> >> --
> >> Walker Hale <walker.hale.iv at gmail.com>
> >> On Wed, Nov 19, 2008 at 3:20 PM, Rage Creation <ragecreations at gmail.com
> >> wrote:
> >> > Hello everyone, I am a new Python coder using the Console module with
> >> > (hopefully simple) question:
> >> > I want to use a fixed-width font for my program, but the Console
> >> > seems to lack a font attribute. I tried using sys.font = "White
> >> > (my
> >> > fixed width font) and it ran with no errors but the output did not
> >> > change. I
> >> > also looked inside of Console.py but there was no setting of a font
> >> > there,
> >> > either.
> >> > Any advice?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Texas