wx2.5, logging to a window

Is it possible to completely turn off this traceback-to-a-window
thing? I want them printed on stderr like normal...

I was hoping that..

class EditPag_App(wx.App):
    
    def OnInit(self):
        wx.InitAllImageHandlers()

        wx.Log.SetActiveTarget(wx.LogStderr())

would do it, but it doesn't.

--Stephen

Try shutting off all redirection by

    class EditPag_App(wx.App):
        ....
        def __init__(self):
            wx.App(self, False)
        ....

But it depends on the wxPython version you are using. See also <wxPython API Documentation — wxPython Phoenix 4.2.2 documentation;

/Jean Brouwers
ProphICy Semiconductor, Inc.

IxokaI wrote:

···

Is it possible to completely turn off this traceback-to-a-window
thing? I want them printed on stderr like normal...

I was hoping that..

class EditPag_App(wx.App):
        def OnInit(self):
        wx.InitAllImageHandlers()

        wx.Log.SetActiveTarget(wx.LogStderr())

would do it, but it doesn't.

--Stephen

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Hm. See, my problem is that if its a fatal error, the window flashes
and the program terminates-- and I don't see the exception.

What i'd -really- like would be for it to output to stdio/stderr AND a
window... hmn.

And i'm using hte latest version of wxPython, just upgraded today.

···

On Wed, 10 Nov 2004 13:13:23 -0600, Jean Brouwers <jbrouwers@prophicy.com> wrote:

Try shutting off all redirection by

    class EditPag_App(wx.App):
        ....
        def __init__(self):
            wx.App(self, False)
        ....

But it depends on the wxPython version you are using. See also <wxPython API Documentation — wxPython Phoenix 4.2.2 documentation;

/Jean Brouwers
ProphICy Semiconductor, Inc.

IxokaI wrote:

> Is it possible to completely turn off this traceback-to-a-window
> thing? I want them printed on stderr like normal...
>
> I was hoping that..
>
> class EditPag_App(wx.App):
>
> def OnInit(self):
> wx.InitAllImageHandlers()
>
> wx.Log.SetActiveTarget(wx.LogStderr())
>
> would do it, but it doesn't.
>
> --Stephen
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

IxokaI wrote:

Hm. See, my problem is that if its a fatal error, the window flashes
and the program terminates-- and I don't see the exception.

What i'd -really- like would be for it to output to stdio/stderr AND a
window... hmn.

Python exceptions don't get written to the wx.Log, but to sys.stderr, so to do something with exception messages you need to replace sys.stderr with some other class that has a write(text) method. wx.App uses wx.PyOnDemandOutputWindow to do it. If you like how it works but would just like to also write to the real stderr then you can do something like this:

class MyOnDemandOutputWindow(wx.PyOnDemandOutputWindow):
  def write(self, text):
    sys.__stderr__.write(text)
    PyOnDemandOutputWindow.write(self, text)

class MyApp(wx.App):
  outputWindowClass = MyOnDemandOutputWindow
  def OnInit(self):
    ...

···

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