Writing a Python font viewer/manager

Jaime Wyant programmer.py at gmail.com
Fri Oct 29 08:50:30 EDT 2004


The code below works in windows.  I assume it works in linux also.  

The code illustrates how to create a "font-picker".  If you want
something more advanced, you could roll up your sleeves and create
your own.  It wouldn't be too bad.  Check out wx.FontEnumerator. 
wx.FontEnumerator will enumerate the fonts on your system (duhhh...)

import wx

app = wx.PySimpleApp()
dlg = wx.FontDialog(None, wx.FontData())
if dlg.ShowModal() == wx.ID_OK:
    fontdata = dlg.GetFontData()
    font = fontdata.GetChosenFont()
    wx.MessageBox("You chose the `%s' font." % font.GetFaceName())
else:
    wx.MessageBox("You pressed cancel and didn't choose any fonts.")

app.MainLoop()

HTH,
jw

On Thu, 28 Oct 2004 23:14:53 +0200, Maciej Dziardziel
<fiedzia at fiedzia.prv.pl> wrote:
> Bats wrote:
> 
> > Hello.
> > On Windows, I used to have a little app that would let me navigate
> > visually through my 20,000+ fonts and I could create groups of them for
> > quick install/remove from the system. It was great to be able to type in a
> > word (say for a logo) and then see it in all the fonts.
>  
> Perhaps take a look at gfontview - not python app, but may show you how to
> access fonts.
> 
> --
> Maciej "Fiedzia" Dziardziel (fiedzia (at) fiedzia (dot) prv (dot) pl)
> www.fiedzia.prv.pl
> 
> 
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list