[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[pygame] xlibconf: easy access to X11 font and color lookup



I started playing with pygame today, and pretty quickly found that
the process of specifying explicit font files and colour tuples got
up my nose. So I wrote a small library, xlibconf, that makes my life
a lot easier.

Here's a small sample:

  >>> import xlibconf
  >>> xlibconf.init(x11lib='/usr/lib/X11')
  # I only want iso8859-1 fonts.
  >>> xlibconf.setFontDefaults(registry='iso8859', encoding='1')
  # give me bold italic arial.
  >>> print xlibconf.getFont(family='arial',weight='bold',slant='i')
  ImmutableSet([('-monotype-Arial-bold-i-normal--0-0-0-0-p-0-iso8859-1',
  '/usr/lib/X11/fonts/TTF/Arialbi.TTF')])
  >>> print xlibconf.getColor("red")
  (255, 0, 0)
  >>> print xlibconf.getColor("#eeddbb")
  (238, 221, 187)

Get version 0.1 of it from 
http://www.interlink.com.au/anthony/tech/xlibconf.py/

Suggestions, complaints, additional ideas all welcome.

Anthony

--
Anthony Baxter     <anthony@interlink.com.au>
It's never too late to have a happy childhood.

____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org