Re: [wxPython-users] removing the wxPython stderr/stdout window

23 views
Skip to first unread message

David Hughes

unread,
Aug 13, 2003, 2:13:00 AM8/13/03
to wxPytho...@lists.wxwindows.org
> I just switched from using wxPySimpleApp to wxApp and
> get this very annoying window that appears with the
> stderr/stdout stuff in it. I want stderr/stdout to
> go to the console like it did before.
>
> Even worse than that, even though I SetTopWindow for
> my frame and SetExitOnFrameDelete(True), the app
> doesn't exit until that stderr/stdout window is shut.
>
> I have tried setting sys.stdout back to sys.__stdout__
> but can't seem to find the right place.
>
> Roger


wxApp takes a number of optional arguments when you create an instance.
The first is redirect=(True/False) which defaults to True for Windows and
MacOS platforms. The second argument is filename=(None/<name>) which
defaults to None. So, if redirect is True, stdout/stderr stuff goes either
to a file or to the window that you are seeing. To have it go to the
console, explicitly set redirect to False.

Er, I don't know if this is officially documented anywhere, but you can
see it all in <python>/Lib/site-packages/wxPython/wx.py

Regards,

David Hughes
Forestfield Software Ltd
www.forestfield.co.uk

Magnus Lyckå

unread,
Aug 14, 2003, 8:17:08 PM8/14/03
to wxPytho...@lists.wxwindows.org
At 23:18 2003-08-12 -0700, Roger Binns wrote:
>I still think it is
>a bug that closing the TopWindow doesn't cause the app to exit if the
>stder/stdout window is displayed.

Maybe you would think differently if some bug in your
code accidentally closed the top window and all your
diagnostics disappeared since the stdout/stderr window
was closed as well...

Also, an application can have several top level windows...


--
Magnus Lycka (It's really Lyck&aring;), mag...@thinkware.se
Thinkware AB, Sweden, www.thinkware.se
I code Python ~ The Agile Programming Language


Roger Binns

unread,
Aug 14, 2003, 10:59:55 PM8/14/03
to wxPytho...@lists.wxwindows.org
> Maybe you would think differently if some bug in your
> code accidentally closed the top window and all your
> diagnostics disappeared since the stdout/stderr window
> was closed as well...
>
> Also, an application can have several top level windows...

You ignored that I explcitly set SetExitOnFrameDelete(True)
and SetTopWindow(). The documentation makes it very clear
that if you do that, closing that top frame will cause
the application to exit. That is exactly why I called
those functions. I don't see how the presence of the
stderr/out window should suddenly make the application
not exit.

As for diagnostics etc, that is an issue for you as a developer
to resolve. I happen to catch exceptions etc and do something
useful with them. I also have a few print statements lying
around as reminders to do some stuff.

If the stderr/out window is important to you, then don't set
SetExitOnFrameDelete

Roger

Reply all
Reply to author
Forward
0 new messages