1999-11-06 03:30:23 -05:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
import wx
|
1999-11-06 03:30:23 -05:00
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
class TestPanel(wx.Panel):
|
1999-11-06 03:30:23 -05:00
|
|
|
def __init__(self, parent, log):
|
2003-12-08 20:23:28 -05:00
|
|
|
wx.Panel.__init__(self, parent, -1)
|
1999-11-06 03:30:23 -05:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
e = wx.FontEnumerator()
|
1999-11-06 03:30:23 -05:00
|
|
|
e.EnumerateFacenames()
|
1999-11-07 02:49:09 -05:00
|
|
|
list = e.GetFacenames()
|
|
|
|
|
1999-11-06 03:30:23 -05:00
|
|
|
list.sort()
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
s1 = wx.StaticText(self, -1, "Face names:")
|
2002-01-28 19:11:38 -05:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
self.lb1 = wx.ListBox(self, -1, wx.DefaultPosition, (200, 250),
|
|
|
|
list, wx.LB_SINGLE)
|
2002-01-28 19:11:38 -05:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
self.Bind(wx.EVT_LISTBOX, self.OnSelect, id=self.lb1.GetId())
|
2003-03-25 01:35:27 -05:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
self.txt = wx.StaticText(self, -1, "Sample text...", (285, 50))
|
|
|
|
|
|
|
|
row = wx.BoxSizer(wx.HORIZONTAL)
|
|
|
|
row.Add(s1, 0, wx.ALL, 5)
|
|
|
|
row.Add(self.lb1, 0, wx.ALL, 5)
|
|
|
|
row.Add(self.txt, 0, wx.ALL|wx.ADJUST_MINSIZE, 5)
|
|
|
|
|
|
|
|
sizer = wx.BoxSizer(wx.VERTICAL)
|
|
|
|
sizer.Add(row, 0, wx.ALL, 30)
|
2003-03-25 01:35:27 -05:00
|
|
|
self.SetSizer(sizer)
|
|
|
|
self.Layout()
|
|
|
|
|
1999-11-06 03:30:23 -05:00
|
|
|
self.lb1.SetSelection(0)
|
2003-07-02 19:13:10 -04:00
|
|
|
self.OnSelect(None)
|
2003-12-08 20:23:28 -05:00
|
|
|
wx.FutureCall(300, self.SetTextSize)
|
2003-07-02 19:13:10 -04:00
|
|
|
|
|
|
|
|
|
|
|
def SetTextSize(self):
|
|
|
|
self.txt.SetSize(self.txt.GetBestSize())
|
1999-11-06 03:30:23 -05:00
|
|
|
|
|
|
|
|
2002-01-28 19:11:38 -05:00
|
|
|
def OnSelect(self, evt):
|
|
|
|
face = self.lb1.GetStringSelection()
|
2003-12-08 20:23:28 -05:00
|
|
|
font = wx.Font(28, wx.DEFAULT, wx.NORMAL, wx.NORMAL, False, face)
|
2003-07-02 19:13:10 -04:00
|
|
|
self.txt.SetLabel(face)
|
2002-01-28 19:11:38 -05:00
|
|
|
self.txt.SetFont(font)
|
2004-01-14 20:24:35 -05:00
|
|
|
if wx.Platform == "__WXMAC__": self.Refresh()
|
2002-01-28 19:11:38 -05:00
|
|
|
|
2002-07-11 16:41:21 -04:00
|
|
|
## st = font.GetNativeFontInfo().ToString()
|
2003-12-08 20:23:28 -05:00
|
|
|
## ni2 = wx.NativeFontInfo()
|
2002-07-11 16:41:21 -04:00
|
|
|
## ni2.FromString(st)
|
2003-12-08 20:23:28 -05:00
|
|
|
## font2 = wx.FontFromNativeInfo(ni2)
|
1999-11-06 03:30:23 -05:00
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
def runTest(frame, nb, log):
|
|
|
|
win = TestPanel(nb, log)
|
|
|
|
return win
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-03-25 01:35:27 -05:00
|
|
|
overview = """<html><body>
|
|
|
|
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.
|
|
|
|
</body></html>
|
1999-11-06 03:30:23 -05:00
|
|
|
"""
|
2002-07-11 16:41:21 -04:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
import sys,os
|
|
|
|
import run
|
|
|
|
run.main(['', os.path.basename(sys.argv[0])])
|
|
|
|
|