X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c856d372d1d4f4223511d2988298ba3d503222a4..6b3f4fb87535df6514c256dc89c6a1abf12c59b4:/wxPython/src/_extras.py?ds=inline diff --git a/wxPython/src/_extras.py b/wxPython/src/_extras.py index 5e16b1f7a4..25799cc90e 100644 --- a/wxPython/src/_extras.py +++ b/wxPython/src/_extras.py @@ -714,20 +714,22 @@ class wxPyOnDemandOutputWindow: self.title = title self.parent = None - 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 output behaviour + # These methods provide the file-like output behaviour. def write(self, str): + if not wxThread_IsMain(): + # Aquire the GUI mutex before making GUI calls. Mutex is released + # when locker is deleted a the end of this function. + locker = wxMutexGuiLocker() + if not self.frame: self.frame = wxFrame(self.parent, -1, self.title) self.text = wxTextCtrl(self.frame, -1, "", @@ -737,13 +739,13 @@ class wxPyOnDemandOutputWindow: EVT_CLOSE(self.frame, self.OnCloseWindow) self.text.AppendText(str) - def close(self): if self.frame != None: + if not wxThread_IsMain(): + locker = wxMutexGuiLocker() self.frame.Close() - _defRedirect = (wxPlatform == '__WXMSW__') #----------------------------------------------------------------------