X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/63b6646e5d4d53611c5ea665701e2b2d978fbd22..3f55f5b81fbe7a2294912663c192113209bbc930:/wxPython/demo/FontEnumerator.py diff --git a/wxPython/demo/FontEnumerator.py b/wxPython/demo/FontEnumerator.py index 27a1466d94..3ac7e51d4a 100644 --- a/wxPython/demo/FontEnumerator.py +++ b/wxPython/demo/FontEnumerator.py @@ -3,46 +3,56 @@ from wxPython.wx import * #---------------------------------------------------------------------- -## class MyFontEnumerator(wxFontEnumerator): -## def __init__(self, list): -## wxFontEnumerator.__init__(self) -## self.list = list - -## def OnFacename(self, face): -## self.list.append(face) -## return true - - class TestPanel(wxPanel): def __init__(self, parent, log): wxPanel.__init__(self, parent, -1) -## list = [] -## e = MyFontEnumerator(list) -## e.EnumerateFacenames() - e = wxFontEnumerator() e.EnumerateFacenames() list = e.GetFacenames() list.sort() - wxStaticText(self, -1, "Face names:", (15, 50), (65, 18)) - self.lb1 = wxListBox(self, -1, (80, 50), (200, 250), + s1 = wxStaticText(self, -1, "Face names:") + self.lb1 = wxListBox(self, -1, wxDefaultPosition, (200, 250), list, wxLB_SINGLE) EVT_LISTBOX(self, self.lb1.GetId(), self.OnSelect) self.txt = wxStaticText(self, -1, "Sample text...", (285, 50)) + row = wxBoxSizer(wxHORIZONTAL) + row.Add(s1, 0, wxALL, 5) + row.Add(self.lb1, 0, wxALL, 5) + row.Add(self.txt, 0, wxALL|wxADJUST_MINSIZE, 5) + + sizer = wxBoxSizer(wxVERTICAL) + sizer.Add(row, 0, wxALL, 30) + self.SetSizer(sizer) + self.Layout() + self.lb1.SetSelection(0) + self.OnSelect(None) + wxFutureCall(300, self.SetTextSize) + + + def SetTextSize(self): + self.txt.SetSize(self.txt.GetBestSize()) def OnSelect(self, evt): + #print "OnSelect: " face = self.lb1.GetStringSelection() - font = wxFont(28, wxDEFAULT, wxNORMAL, wxNORMAL, false, face) + #print '\t '+face + font = wxFont(28, wxDEFAULT, wxNORMAL, wxNORMAL, False, face) + #print "\t got font" + self.txt.SetLabel(face) + #print "\t set label" self.txt.SetFont(font) - self.txt.SetSize(self.txt.GetBestSize()) + #print "\t set font" + #self.txt.SetSize(self.txt.GetBestSize()) + #print "\t set size" + ## st = font.GetNativeFontInfo().ToString() ## ni2 = wxNativeFontInfo() @@ -64,9 +74,12 @@ def runTest(frame, nb, log): -overview = """\ -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. - +overview = """ +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. + """