Fonts

Eric Brunel eric_brunel at despammed.com
Mon Feb 28 06:24:05 EST 2005


On Fri, 25 Feb 2005 11:00:41 -0600, phil <phillip.watts at anvilcom.com> wrote:
> I'm cpmpletely lost on fonts.
>
> I'm using Tkinter
>
> I do medarial = '-*-Arial-Bold-*-*--24-*-*-*-ISO8859-1"
> or Courier or Fixed in various sizes.
>
> Works great on my RH 7.2
>
> But a small embedded system Im working on, nothing seems to work,
> almost everything falls back to a fixed 12

You should be able to use a font specification like (family, size [, style]), e.g ('helvetica', 24, 'bold'). This is the most portable way of specifying fonts (X11 font names may not work on some systems).

You can get the available font families on your system as seen by Tkinter/tk with:

 from Tkinter import *
import tkFont
root = Tk()
print tkFont.families()

BTW - according to http://www.tcl.tk/man/tcl8.4/TkCmd/font.htm#M25 - the font family names 'helvetica', 'times' and 'courier' are guaranteed to work anywhere with tk/Tkinter.

HTH
-- 
python -c 'print "".join([chr(154 - ord(c)) for c in "U(17zX(%,5.z^5(17l8(%,5.Z*(93-965$l7+-"])'



More information about the Python-list mailing list