wx.App won't redirect with XRC

Hi,

This is probably just an oversight on my part, but for the life of me I
cannot get my class to redirect output when I use XRC to generate the GUI.
If I hand-code my GUI, I can use wx.App's redirect ability to pop a box up
with all my prints and other test code. But when I switch to the XRC
method, it only prints to stdout. Do I need to create a custom pop-up box
and redirect stdout/stderr as a workaround?

I have included a simple example along with an xrc file. I am on Windows
XP, Python 2.4, wxPython 2.8.

Mike Driscoll
Applications Specialist
MCIS - Technology Center

test.py (657 Bytes)

test.xrc (504 Bytes)

Mike Driscoll wrote:

Hi,

This is probably just an oversight on my part, but for the life of me I
cannot get my class to redirect output when I use XRC to generate the GUI.
If I hand-code my GUI, I can use wx.App's redirect ability to pop a box up
with all my prints and other test code. But when I switch to the XRC
method, it only prints to stdout. Do I need to create a custom pop-up box
and redirect stdout/stderr as a workaround?

I have included a simple example along with an xrc file. I am on Windows
XP, Python 2.4, wxPython 2.8.

class TestApp(wx.App):
    def __init__(self, redirect=True, filename=None):
        wx.App.__init__(self, redirect, filename)

[...]

if __name__ == '__main__':
    app = TestApp(False)

Did you realize you are passing False here? As soon as I change it to True then the redirection does work for me.

ยทยทยท

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!