]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/FontEnumerator.py
2 from wxPython
. wx
import *
4 #----------------------------------------------------------------------
6 ## class MyFontEnumerator(wxFontEnumerator):
7 ## def __init__(self, list):
8 ## wxFontEnumerator.__init__(self)
11 ## def OnFacename(self, face):
12 ## self.list.append(face)
17 class TestPanel ( wxPanel
):
18 def __init__ ( self
, parent
, log
):
19 wxPanel
.__ init
__ ( self
, parent
, - 1 )
22 ## e = MyFontEnumerator(list)
23 ## e.EnumerateFacenames()
25 e
= wxFontEnumerator ()
26 e
. EnumerateFacenames ()
27 list = e
. GetFacenames ()
31 wxStaticText ( self
, - 1 , "Face names:" , ( 15 , 50 ), ( 65 , 18 ))
32 self
. lb1
= wxListBox ( self
, - 1 , ( 80 , 50 ), ( 200 , 250 ),
34 EVT_LISTBOX ( self
, self
. lb1
. GetId (), self
. OnSelect
)
36 self
. txt
= wxStaticText ( self
, - 1 , "Sample text..." , ( 285 , 50 ))
38 self
. lb1
. SetSelection ( 0 )
41 def OnSelect ( self
, evt
):
42 face
= self
. lb1
. GetStringSelection ()
43 font
= wxFont ( 28 , wxDEFAULT
, wxNORMAL
, wxNORMAL
, false
, face
)
44 self
. txt
. SetFont ( font
)
45 self
. txt
. SetSize ( self
. txt
. GetBestSize ())
49 #----------------------------------------------------------------------
51 def runTest ( frame
, nb
, log
):
52 win
= TestPanel ( nb
, log
)
55 #----------------------------------------------------------------------
69 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.