]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/_extras.py
Got a new version of StructuredText from Zope's CVS.
[wxWidgets.git] / wxPython / src / _extras.py
index 5e16b1f7a4278c8cbd95ba5edada622933901be7..f8698fb0501f5752d6c9fe78cae74dd37e647d3a 100644 (file)
@@ -714,22 +714,25 @@ 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 at the end of this function.
+            locker = wxMutexGuiLocker()
+
         if not self.frame:
-            self.frame = wxFrame(self.parent, -1, self.title)
+            self.frame = wxFrame(self.parent, -1, self.title,
+                                 style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
             self.text  = wxTextCtrl(self.frame, -1, "",
                                     style = wxTE_MULTILINE|wxTE_READONLY)
             self.frame.SetSize(wxSize(450, 300))
@@ -737,13 +740,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__')
 
 #----------------------------------------------------------------------