phoenix_title wx.LogGui

This is the default log target for the GUI wxWidgets applications.

Please see Logging Customization for explanation of how to change the default log target.

An object of this class is used by default to show the log messages created by using wx.LogMessage , wx.LogError and other logging functions. It doesn’t display the messages logged by them immediately however but accumulates all messages logged during an event handler execution and then shows them all at once when its Flush method is called during the idle time processing. This has the important advantage of showing only a single dialog to the user even if several messages were logged because of a single error as it often happens (e.g. a low level function could log a message because it failed to open a file resulting in its caller logging another message due to the failure of higher level operation requiring the use of this file). If you need to force the display of all previously logged messages immediately you can use wx.Log.FlushActive to force the dialog display.

Also notice that if an error message is logged when several informative messages had been already logged before, the informative messages are discarded on the assumption that they are not useful – and may be confusing and hence harmful – any more after the error. The warning and error messages are never discarded however and any informational messages logged after the first error one are also kept (as they may contain information about the error recovery). You may override DoLog() method to change this behaviour.

At any rate, it is possible that that several messages were accumulated before this class Flush method is called. If this is the case, Flush uses a custom dialog which shows the last message directly and allows the user to view the previously logged ones by expanding the “Details” wx.CollapsiblePane inside it. This custom dialog also provides the buttons for copying the log messages to the clipboard and saving them to a file.

However if only a single message is present when Flush is called, just a wx.MessageBox is used to show it. This has the advantage of being closer to the native behaviour but it doesn’t give the user any possibility to copy or save the message (except for the recent Windows versions where Ctrl-C may be pressed in the message box to copy its contents to the clipboard) so you may want to override DoShowSingleLogMessage to customize wx.LogGui – the dialogs sample shows how to do this.


class_hierarchy Class Hierarchy

Inheritance diagram for class LogGui:

method_summary Methods Summary

__init__

Default constructor.

Flush

Presents the accumulated log messages, if any, to the user.


api Class API

class wx.LogGui(Log)

Possible constructors:

LogGui()

This is the default log target for the GUI wxWidgets applications.


Methods

__init__(self)

Default constructor.



Flush(self)

Presents the accumulated log messages, if any, to the user.

This method is called during the idle time and should show any messages accumulated in LogGui.m_aMessages field to the user.