]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/FontEnumerator.py
Removed wxGetOsVersion stub. It's now handled by utilscmn.cpp.
[wxWidgets.git] / wxPython / demo / FontEnumerator.py
CommitLineData
b1462dfa
RD
1
2from wxPython.wx import *
3
4#----------------------------------------------------------------------
5
b1462dfa
RD
6
7class TestPanel(wxPanel):
8 def __init__(self, parent, log):
9 wxPanel.__init__(self, parent, -1)
10
65dd82cb 11 e = wxFontEnumerator()
b1462dfa 12 e.EnumerateFacenames()
65dd82cb
RD
13 list = e.GetFacenames()
14
b1462dfa
RD
15 list.sort()
16
1e4a197e
RD
17 s1 = wxStaticText(self, -1, "Face names:")
18 self.lb1 = wxListBox(self, -1, wxDefaultPosition, (200, 250),
b1462dfa 19 list, wxLB_SINGLE)
c6c593e8
RD
20 EVT_LISTBOX(self, self.lb1.GetId(), self.OnSelect)
21
22 self.txt = wxStaticText(self, -1, "Sample text...", (285, 50))
23
1e4a197e
RD
24 row = wxBoxSizer(wxHORIZONTAL)
25 row.Add(s1, 0, wxALL, 5)
26 row.Add(self.lb1, 0, wxALL, 5)
27 row.Add(self.txt, 0, wxALL, 5)
28
29 sizer = wxBoxSizer(wxVERTICAL)
30 sizer.Add(row, 0, wxALL, 30)
31 self.SetSizer(sizer)
32 self.Layout()
33
b1462dfa
RD
34 self.lb1.SetSelection(0)
35
36
c6c593e8
RD
37 def OnSelect(self, evt):
38 face = self.lb1.GetStringSelection()
1e4a197e 39 font = wxFont(28, wxDEFAULT, wxNORMAL, wxNORMAL, False, face)
c6c593e8
RD
40 self.txt.SetFont(font)
41 self.txt.SetSize(self.txt.GetBestSize())
42
63b6646e
RD
43## st = font.GetNativeFontInfo().ToString()
44## ni2 = wxNativeFontInfo()
45## ni2.FromString(st)
46## font2 = wxFontFromNativeInfo(ni2)
b1462dfa 47
b1462dfa
RD
48#----------------------------------------------------------------------
49
50def runTest(frame, nb, log):
51 win = TestPanel(nb, log)
52 return win
53
54#----------------------------------------------------------------------
55
56
57
58
59
60
61
62
1e4a197e
RD
63overview = """<html><body>
64wxFontEnumerator enumerates either all available fonts on the system or only
65the ones with given attributes - either only fixed-width (suited for use in
66programs such as terminal emulators and the like) or the fonts available in
67the given encoding.
68</body></html>
b1462dfa 69"""
63b6646e
RD
70
71
72if __name__ == '__main__':
73 import sys,os
74 import run
75 run.main(['', os.path.basename(sys.argv[0])])
76