1999-11-06 08:30:23 +00:00
|
|
|
|
|
|
|
from wxPython.wx import *
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
1999-11-07 07:49:09 +00:00
|
|
|
## class MyFontEnumerator(wxFontEnumerator):
|
|
|
|
## def __init__(self, list):
|
|
|
|
## wxFontEnumerator.__init__(self)
|
|
|
|
## self.list = list
|
1999-11-06 08:30:23 +00:00
|
|
|
|
1999-11-07 07:49:09 +00:00
|
|
|
## def OnFacename(self, face):
|
|
|
|
## self.list.append(face)
|
|
|
|
## return true
|
1999-11-06 08:30:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestPanel(wxPanel):
|
|
|
|
def __init__(self, parent, log):
|
|
|
|
wxPanel.__init__(self, parent, -1)
|
|
|
|
|
1999-11-07 07:49:09 +00:00
|
|
|
## list = []
|
|
|
|
## e = MyFontEnumerator(list)
|
|
|
|
## e.EnumerateFacenames()
|
|
|
|
|
|
|
|
e = wxFontEnumerator()
|
1999-11-06 08:30:23 +00:00
|
|
|
e.EnumerateFacenames()
|
1999-11-07 07:49:09 +00:00
|
|
|
list = e.GetFacenames()
|
|
|
|
|
1999-11-06 08:30:23 +00:00
|
|
|
list.sort()
|
|
|
|
|
2002-01-29 00:11:38 +00:00
|
|
|
wxStaticText(self, -1, "Face names:", (15, 50), (65, 18))
|
|
|
|
self.lb1 = wxListBox(self, -1, (80, 50), (200, 250),
|
1999-11-06 08:30:23 +00:00
|
|
|
list, wxLB_SINGLE)
|
2002-01-29 00:11:38 +00:00
|
|
|
EVT_LISTBOX(self, self.lb1.GetId(), self.OnSelect)
|
|
|
|
|
|
|
|
self.txt = wxStaticText(self, -1, "Sample text...", (285, 50))
|
|
|
|
|
1999-11-06 08:30:23 +00:00
|
|
|
self.lb1.SetSelection(0)
|
|
|
|
|
|
|
|
|
2002-01-29 00:11:38 +00:00
|
|
|
def OnSelect(self, evt):
|
|
|
|
face = self.lb1.GetStringSelection()
|
|
|
|
font = wxFont(28, wxDEFAULT, wxNORMAL, wxNORMAL, false, face)
|
|
|
|
self.txt.SetFont(font)
|
|
|
|
self.txt.SetSize(self.txt.GetBestSize())
|
|
|
|
|
|
|
|
|
1999-11-06 08:30:23 +00:00
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
def runTest(frame, nb, log):
|
|
|
|
win = TestPanel(nb, log)
|
|
|
|
return win
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
overview = """\
|
|
|
|
wxFontEnumerator enumerates either all available fonts on the system or only the ones with given attributes - either only fixed-width (suited for use in programs such as terminal emulators and the like) or the fonts available in the given encoding.
|
|
|
|
|
|
|
|
"""
|