X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4deafe31225a9e168e1a2a0e0cb0288a09233345..d3a80c922c7f0932f0b3985846e58ef48e3a6da7:/wxPython/demo/wxTextCtrl.py diff --git a/wxPython/demo/wxTextCtrl.py b/wxPython/demo/wxTextCtrl.py index dc6ee5f79a..7b55456399 100644 --- a/wxPython/demo/wxTextCtrl.py +++ b/wxPython/demo/wxTextCtrl.py @@ -47,16 +47,13 @@ class TestPanel(wxPanel): l4 = wxStaticText(self, -1, "Rich Text") t4 = wxTextCtrl(self, 40, "If supported by the native control, this is red, and this is a different font.", - size=(200, 100), style=wxTE_MULTILINE|wxTE_RICH) + size=(200, 100), style=wxTE_MULTILINE|wxTE_RICH2) t4.SetInsertionPoint(0) t4.SetStyle(44, 47, wxTextAttr("RED", "YELLOW")) points = t4.GetFont().GetPointSize() # get the current size f = wxFont(points+3, wxROMAN, wxITALIC, wxBOLD, true) -## print 'a1', sys.getrefcount(f) -## t4.SetStyle(63, 77, wxTextAttr("BLUE", font=f)) t4.SetStyle(63, 77, wxTextAttr("BLUE", wxNullColour, f)) -## print 'a2', sys.getrefcount(f) bsizer = wxBoxSizer(wxVERTICAL) bsizer.Add(b, 0, wxGROW) @@ -90,11 +87,14 @@ class TestPanel(wxPanel): def OnTestGetSelection(self, evt): start, end = self.tc.GetSelection() text = self.tc.GetValue() - # Looks like a bug here, but only if not wxTE_RICH... - if wxPlatform == "__WXMSW__": + if wxPlatform == "__WXMSW__": # This is why GetStringSelection was added text = string.replace(text, '\n', '\r\n') - self.log.write("GetSelection(): (%d, %d)\n\tSelectedText: %s\n" % - (start, end, repr(text[start:end]))) + self.log.write("GetSelection(): (%d, %d)\n" + "\tGetStringSelection(): %s\n" + "\tSelectedText: %s\n" % + (start, end, + self.tc.GetStringSelection(), + repr(text[start:end]))) #--------------------------------------------------------------------------- @@ -110,3 +110,12 @@ def runTest(frame, nb, log): overview = """\ """ + + + + +if __name__ == '__main__': + import sys,os + import run + run.main(['', os.path.basename(sys.argv[0])]) +