win.Connect(-1, -1, wxEVT_QUERY_NEW_PALETTE, func)
def EVT_WINDOW_CREATE(win, func):
- win.Connect(-1, -1, wxEVT_WINDOW_CREATE, func)
+ win.Connect(-1, -1, wxEVT_CREATE, func)
def EVT_WINDOW_DESTROY(win, func):
- win.Connect(-1, -1, wxEVT_WINDOW_DESTROY, func)
+ win.Connect(-1, -1, wxEVT_DESTROY, func)
self.frame = None
self.title = title
+
def SetParent(self, parent):
self.parent = parent
+
def OnCloseWindow(self, event):
if self.frame != None:
self.frame.Destroy()
self.frame = None
self.text = None
+
# this provides the file-like behaviour
def write(self, str):
if not self.frame:
EVT_CLOSE(self.frame, self.OnCloseWindow)
self.text.AppendText(str)
+
def close(self):
+ if self.frame != None:
+ self.frame.Destroy()
self.frame = None
self.text = None
def SetTopWindow(self, frame):
if self.stdioWin:
self.stdioWin.SetParent(frame)
- sys.stdout = self.stdioWin #sys.stderr =
+ sys.stderr = sys.stdout = self.stdioWin
wxPyApp.SetTopWindow(self, frame)
+
def MainLoop(self):
wxPyApp.MainLoop(self)
self.RestoreStdio()
+
def RedirectStdio(self, filename):
if filename:
sys.stdout = sys.stderr = open(filename, 'a')
else:
self.stdioWin = self.outputWindowClass() # wxPyOnDemandOutputWindow
+
def RestoreStdio(self):
sys.stdout, sys.stderr = self.saveStdio
if self.stdioWin != None: