]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/FontEnumerator.py
4 #----------------------------------------------------------------------
7 class TestPanel(wx
.Panel
):
8 def __init__(self
, parent
, log
):
9 wx
.Panel
.__init
__(self
, parent
, -1)
11 e
= wx
.FontEnumerator()
12 e
.EnumerateFacenames()
13 list = e
.GetFacenames()
17 s1
= wx
.StaticText(self
, -1, "Face names:")
19 self
.lb1
= wx
.ListBox(self
, -1, wx
.DefaultPosition
, (200, 250),
22 self
.Bind(wx
.EVT_LISTBOX
, self
.OnSelect
, id=self
.lb1
.GetId())
24 self
.txt
= wx
.StaticText(self
, -1, "Sample text...", (285, 50))
26 row
= wx
.BoxSizer(wx
.HORIZONTAL
)
27 row
.Add(s1
, 0, wx
.ALL
, 5)
28 row
.Add(self
.lb1
, 0, wx
.ALL
, 5)
29 row
.Add(self
.txt
, 0, wx
.ALL|wx
.ADJUST_MINSIZE
, 5)
31 sizer
= wx
.BoxSizer(wx
.VERTICAL
)
32 sizer
.Add(row
, 0, wx
.ALL
, 30)
36 self
.lb1
.SetSelection(0)
38 wx
.FutureCall(300, self
.SetTextSize
)
41 def SetTextSize(self
):
42 self
.txt
.SetSize(self
.txt
.GetBestSize())
45 def OnSelect(self
, evt
):
46 face
= self
.lb1
.GetStringSelection()
47 font
= wx
.Font(28, wx
.DEFAULT
, wx
.NORMAL
, wx
.NORMAL
, False, face
)
48 self
.txt
.SetLabel(face
)
49 self
.txt
.SetFont(font
)
50 if wx
.Platform
== "__WXMAC__": self
.Refresh()
52 ## st = font.GetNativeFontInfo().ToString()
53 ## ni2 = wx.NativeFontInfo()
55 ## font2 = wx.FontFromNativeInfo(ni2)
57 #----------------------------------------------------------------------
59 def runTest(frame
, nb
, log
):
60 win
= TestPanel(nb
, log
)
63 #----------------------------------------------------------------------
67 overview
= """<html><body>
68 wxFontEnumerator enumerates either all available fonts on the system or only
69 the ones with given attributes - either only fixed-width (suited for use in
70 programs such as terminal emulators and the like) or the fonts available in
76 if __name__
== '__main__':
79 run
.main(['', os
.path
.basename(sys
.argv
[0])])