X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/10ef30eb534117ae854c9d099101c862fe96bcb0..57351df0a60b1f2302f66a8d687285c3f5a54fd0:/wxPython/demo/wxStyledTextCtrl_1.py diff --git a/wxPython/demo/wxStyledTextCtrl_1.py b/wxPython/demo/wxStyledTextCtrl_1.py index ed9a403f72..e0964cf78a 100644 --- a/wxPython/demo/wxStyledTextCtrl_1.py +++ b/wxPython/demo/wxStyledTextCtrl_1.py @@ -60,6 +60,14 @@ class MySTC(wxStyledTextCtrl): EVT_STC_START_DRAG(self, ID, self.OnStartDrag) EVT_STC_MODIFIED(self, ID, self.OnModified) + EVT_WINDOW_DESTROY(self, self.OnDestroy) + + def OnDestroy(self, evt): + # This is how the clipboard contents can be preserved after + # the app has exited. + wxTheClipboard.Flush() + evt.Skip() + def OnStartDrag(self, evt): self.log.write("OnStartDrag: %d, %s\n" @@ -146,7 +154,7 @@ def runTest(frame, nb, log): ed = p = MySTC(nb, -1, log) else: - p = wxPanel(nb, -1) + p = wxPanel(nb, -1, style=wxNO_FULL_REPAINT_ON_RESIZE) ed = MySTC(p, -1, log) s = wxBoxSizer(wxHORIZONTAL) s.Add(ed, 1, wxEXPAND) @@ -243,10 +251,12 @@ def runTest(frame, nb, log): ed.SetSelection(25, 35) print "GetSelectedText(): ", repr(ed.GetSelectedText()) print "GetTextRange(25, 35): ", repr(ed.GetTextRange(25, 35)) - + print "FindText(0, max, 'indicators'): ", + print ed.FindText(0, ed.GetTextLength(), "indicators") ed.GotoPos(0) + return p @@ -263,13 +273,8 @@ be helpful. """ - if __name__ == '__main__': - import sys - app = wxPySimpleApp() - frame = wxFrame(None, -1, "Tester...", size=(640, 480)) - win = runTest(frame, frame, sys.stdout) - frame.Show(true) - app.MainLoop() - + import sys,os + import run + run.main(['', os.path.basename(sys.argv[0])])