wxPython – How to Display stderr stdout window

By | July 31, 2020

wxpython

While executing a wxpython script if a error occurs then a white window popups with some message, and it disappears fast enough before it can be read.

So here is a fix to pause it and read it what and where the error in the code is :

app = wx.App(redirect=False)
MyFrame(None).Show()
app.MainLoop()

The wx.App takes this parameter called redirect which can be True or False.

It defaults to True for Windows and MacOS. Another argument is filename=(None/) which defaults to None. So, if redirect is True, stdout/stderr stuff goes either to a file or to the window and this window stay for a split of a second and disappears.

Setting the redirect argument to False makes the window stay or the output goes to console depending on whether the python file is run from console or scite text editor.

About Silver Moon

A Tech Enthusiast, Blogger, Linux Fan and a Software Developer. Writes about Computer hardware, Linux and Open Source software and coding in Python, Php and Javascript. He can be reached at [email protected].

One Comment

wxPython – How to Display stderr stdout window

Leave a Reply

Your email address will not be published. Required fields are marked *