]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/FontEnumerator.py
2 from wxPython
.wx
import *
4 #----------------------------------------------------------------------
7 class TestPanel(wxPanel
):
8 def __init__(self
, parent
, log
):
9 wxPanel
.__init
__(self
, parent
, -1)
11 e
= wxFontEnumerator()
12 e
.EnumerateFacenames()
13 list = e
.GetFacenames()
17 s1
= wxStaticText(self
, -1, "Face names:")
18 self
.lb1
= wxListBox(self
, -1, wxDefaultPosition
, (200, 250),
20 EVT_LISTBOX(self
, self
.lb1
.GetId(), self
.OnSelect
)
22 self
.txt
= wxStaticText(self
, -1, "Sample text...", (285, 50))
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|wxADJUST_MINSIZE
, 5)
29 sizer
= wxBoxSizer(wxVERTICAL
)
30 sizer
.Add(row
, 0, wxALL
, 30)
34 self
.lb1
.SetSelection(0)
36 wxFutureCall(300, self
.SetTextSize
)
39 def SetTextSize(self
):
40 self
.txt
.SetSize(self
.txt
.GetBestSize())
43 def OnSelect(self
, evt
):
45 face
= self
.lb1
.GetStringSelection()
47 font
= wxFont(28, wxDEFAULT
, wxNORMAL
, wxNORMAL
, False, face
)
49 self
.txt
.SetLabel(face
)
51 self
.txt
.SetFont(font
)
53 #self.txt.SetSize(self.txt.GetBestSize())
57 ## st = font.GetNativeFontInfo().ToString()
58 ## ni2 = wxNativeFontInfo()
60 ## font2 = wxFontFromNativeInfo(ni2)
62 #----------------------------------------------------------------------
64 def runTest(frame
, nb
, log
):
65 win
= TestPanel(nb
, log
)
68 #----------------------------------------------------------------------
77 overview
= """<html><body>
78 wxFontEnumerator enumerates either all available fonts on the system or only
79 the ones with given attributes - either only fixed-width (suited for use in
80 programs such as terminal emulators and the like) or the fonts available in
86 if __name__
== '__main__':
89 run
.main(['', os
.path
.basename(sys
.argv
[0])])