why doesn't fontlist sort work ?

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 ?

thanks,
Stef

Stef,

<div class="moz-text-flowed" style="font-family: -moz-fixed">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 ?

thanks,
Stef

</div>

This is a sneaky Python thing. Sorting is done "in place", so if you try to assign that, it return none. Instead, change you sort line to:

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

See also: HowTo/Sorting - Python Wiki

Mike