diff --git a/etg/_core.py b/etg/_core.py index 6192fdf7..874962ef 100644 --- a/etg/_core.py +++ b/etg/_core.py @@ -419,6 +419,11 @@ def run(): ]) + module.addCppFunction('bool', 'IsMainThread', '()', + doc="Returns True if the current thread is what wx considers the GUI thread.", + body="return wxThread::IsMain();") + + module.addInitializerCode("""\ wxPyPreInit(sipModuleDict); """) diff --git a/etg/app.py b/etg/app.py index 1fd70007..df723b8f 100644 --- a/etg/app.py +++ b/etg/app.py @@ -270,12 +270,12 @@ def run(): """, body="""\ if self.frame is None: - if not wx.Thread.IsMain(): + if not wx.IsMainThread(): wx.CallAfter(self.CreateOutputWindow, text) else: self.CreateOutputWindow(text) else: - if not wx.Thread.IsMain(): + if not wx.IsMainThread(): wx.CallAfter(self.text.AppendText, text) else: self.text.AppendText(text)