I'd like to popup a wx.LogError window in an application that has no frame. Seems like the shortest easiest way to show an error message.
Attached is the code.
If running:
> python logError.py
I should get the wx.LogError shown, but it doesn't show up.
If now, I used a wx.MessageDialog (see commented out lines 8 to 10) instead of wx.LogError, it works. But I'd like to avoid using wx.MessageDialog. Is there a trick ?
The default log target does not create and show the log window at the time that wx.LogError (or any of the other logger functions) is called. Instead it collects messages and then displays them in the next idle event. That way if there is some sequence of code that would generate dozens of log messages you don't have to deal with dozens of log windows, just one that shows them all. In your code since there no top level window existing at the time that MainLoop is called then it just exits immediately without doing much of anything.
···
On 7/28/10 3:56 PM, Raphael Mayoraz wrote:
Hello,
I'd like to popup a wx.LogError window in an application that has no
frame. Seems like the shortest easiest way to show an error message.
Attached is the code.
If running:
> python logError.py
I should get the wx.LogError shown, but it doesn't show up.
If now, I used a wx.MessageDialog (see commented out lines 8 to 10)
instead of wx.LogError, it works. But I'd like to avoid using
wx.MessageDialog. Is there a trick ?
I'd like to popup a wx.LogError window in an application that has no
frame. Seems like the shortest easiest way to show an error message.
Attached is the code.
If running:
> python logError.py
I should get the wx.LogError shown, but it doesn't show up.
If now, I used a wx.MessageDialog (see commented out lines 8 to 10)
instead of wx.LogError, it works. But I'd like to avoid using
wx.MessageDialog. Is there a trick ?
The default log target does not create and show the log window at the time that wx.LogError (or any of the other logger functions) is called. Instead it collects messages and then displays them in the next idle event. That way if there is some sequence of code that would generate dozens of log messages you don't have to deal with dozens of log windows, just one that shows them all. In your code since there no top level window existing at the time that MainLoop is called then it just exits immediately without doing much of anything.
Thanks for the explanation. I'll do it with wx.MessageDialog.