From ddf0022ff3f8d4b76a1619376904339b29e873bd Mon Sep 17 00:00:00 2001 From: Gyedo Jeon Date: Mon, 12 Apr 2010 20:59:09 +0000 Subject: [PATCH] Creating own log window to capture logs from wx.Log --- direct/src/wxwidgets/WxAppShell.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/direct/src/wxwidgets/WxAppShell.py b/direct/src/wxwidgets/WxAppShell.py index 036d485a70..d74eb34647 100755 --- a/direct/src/wxwidgets/WxAppShell.py +++ b/direct/src/wxwidgets/WxAppShell.py @@ -29,13 +29,14 @@ class WxAppShell(wx.Frame): kw['size'] = wx.Size(self.frameWidth, self.frameHeight) wx.Frame.__init__(self, None, -1, *args, **kw) + self._logWin = None # Initialize the application self.appInit() - self.__createInterface() self.Show() def __createInterface(self): + self.__createLogWin() self.__createMenuBar() self.__createAboutBox() # Add binding for panel cleanup code @@ -47,6 +48,14 @@ class WxAppShell(wx.Frame): self.createMenuBar() self.createInterface() + def __createLogWin(self, evt=None): + # to bypass wx.Log + if self._logWin: + self._logWin.Destroy() + self._logWin = wx.Frame(None) + self._logWin.Bind(wx.EVT_CLOSE, self.__createLogWin) + wx.Log.SetActiveTarget(wx.LogTextCtrl(wx.TextCtrl(self._logWin, style=wx.TE_MULTILINE))) + def __createMenuBar(self): self.menuBar = wx.MenuBar() self.SetMenuBar(self.menuBar) @@ -103,4 +112,3 @@ class WxAppShell(wx.Frame): menuItem = self.menuHelp.Append(wx.ID_ABOUT, "&About...") self.Bind(wx.EVT_MENU, self.showAbout, menuItem) -