why doesn't fontlist sort work ?

Tim Roberts wrote:

···

On Fri, 02 May 2008 10:14:28 +0200, Stef Mientki <s.mientki@ru.nl> wrote:

hello,
I want to see all available fonts,
so I used the following:

  fonts = wx.FontEnumerator ()
  fonts.EnumerateFacenames ()
  fontList = fonts.GetFacenames ()#.sort()
  print fontList

now if I want to see the list ordered,
I would expect to add the sort() method
(I've verified that the type of fontList equals list),
but I get None ?
  
Here again, we have one of the "classic Python blunders". :wink:

you mean a blunder of Python :wink:
Thanks Tim,
I now remember, but for how long ?

cheers,
Stef

From jonhattan jonhattan@faita.net I received on December 23, 2007 the following answer to the same question:

You have to subclass wx.FontEnumerator and override OnFacename:

class FE(wx.FontEnumerator):
def OnFacename(self, fontname):
print fontname

fe = FE()
fe.EnumerateFacenames(wx

.FONTENCODING_SYSTEM, fixedWidthOnly = True)

Andale Mono

Bitstream Vera Sans Mono

Counterscraps

Courier

Courier 10 Pitch

Courier New

DejaVu Sans Mono

FreeMono

Larabiefont

Lucida Sans Typewriter

Mitra Mono

Monofonto

Monospace

Nimbus Mono L

TlwgMono

TlwgTypewriter

Unispace

– jonhattan

And jonhattan code works.

···

2008/5/2 Stef Mientki s.mientki@ru.nl:

Tim Roberts wrote:

On Fri, 02 May 2008 10:14:28 +0200, Stef Mientki s.mientki@ru.nl wrote:

hello,

I want to see all available fonts,

so I used the following:

fonts = wx.FontEnumerator ()

fonts.EnumerateFacenames ()

fontList = fonts.GetFacenames ()#.sort()

print fontList

now if I want to see the list ordered,

I would expect to add the sort() method

(I’ve verified that the type of fontList equals list),

but I get None ?

Here again, we have one of the “classic Python blunders”. :wink:
you mean a blunder of Python :wink:

Thanks Tim,

I now remember, but for how long ?

cheers,

Stef


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users