On 8/20/07, [david] <[EMAIL PROTECTED]> wrote:
>
> What am I doing wrong?
> I'm trying to capture stdErr in a multi-threaded program.


You can't reliably access the GUI anywhere except in the main thread; you're
printing to stderr from the worker thread, and thus its writing to the GUI
control, and that action is occuring within the worker thread. Sometimes
it'll work. Eventually it'll always fail.

Try adjusting the write method of RedirectText to:

    def write(self,string):
        wx.CallAfter(self.out.WriteText, string)

"wx.CallAfter" is a convienence function to call from a worker thread "into"
the GUI thread and execute the specified method with the given options. It
makes modifying the GUI very easy.

--S
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to