X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/83b18bab391d242907d18b4b040720eae6202f76..23122f8c57a180513a1f750a255ecdac2f61b1a3:/wxPython/src/_extras.py?ds=sidebyside diff --git a/wxPython/src/_extras.py b/wxPython/src/_extras.py index ebc8ca9afb..5e16b1f7a4 100644 --- a/wxPython/src/_extras.py +++ b/wxPython/src/_extras.py @@ -705,12 +705,14 @@ def wxPyTypeCast(obj, typeStr): return theObj +#---------------------------------------------------------------------- #---------------------------------------------------------------------- class wxPyOnDemandOutputWindow: def __init__(self, title = "wxPython: stdout/stderr"): self.frame = None self.title = title + self.parent = None def SetParent(self, parent): @@ -724,7 +726,7 @@ class wxPyOnDemandOutputWindow: self.text = None - # this provides the file-like behaviour + # this provides the file-like output behaviour def write(self, str): if not self.frame: self.frame = wxFrame(self.parent, -1, self.title) @@ -738,9 +740,7 @@ class wxPyOnDemandOutputWindow: def close(self): if self.frame != None: - self.frame.Destroy() - self.frame = None - self.text = None + self.frame.Close() @@ -774,7 +774,6 @@ class wxApp(wxPyApp): def SetTopWindow(self, frame): if self.stdioWin: self.stdioWin.SetParent(frame) - sys.stderr = sys.stdout = self.stdioWin wxPyApp.SetTopWindow(self, frame) @@ -788,12 +787,12 @@ class wxApp(wxPyApp): sys.stdout = sys.stderr = open(filename, 'a') else: self.stdioWin = self.outputWindowClass() # wxPyOnDemandOutputWindow + sys.stdout = sys.stderr = self.stdioWin def RestoreStdio(self): sys.stdout, sys.stderr = self.saveStdio - if self.stdioWin != None: - self.stdioWin.close() + #----------------------------------------------------------------------------