wx.App

Inheritance diagram for wx.App:



Description

The wx.App class represents the application itself. It is used to:

  • Set and get application-wide properties;
  • Implement the windowing system message or event loop;
  • Initiate application processing via OnInit;
  • Allow default processing of events not handled by other objects in the application.

Derived From

Class API

Methods

__init__(redirect=True, filename=None, useBestVisual=False, clearSigInt=True)

Construct a wx.App object.

Parameters:

  • redirect (bool): Should sys.stdout and sys.stderr be redirected? Defaults to True on Windows and Mac, False otherwise. If filename is None then output will be redirected to a window that pops up as needed. (You can control what kind of window is created for the output by resetting the class variable outputWindowClass to a class of your choosing)
  • filename (string): The name of a file to redirect output to, if redirect is True.
  • useBestVisual (bool): Should the app try to use the best available visual provided by the system (only relevant on systems that have more than one visual.) This parameter must be used instead of calling SetUseBestVisual later on because it must be set before the underlying GUI toolkit is initialized.
  • clearSigInt (bool): Should SIGINT be cleared? This allows the app to terminate upon a Ctrl-C in the console like other GUI apps will.

Note

You should override OnInit to do applicaition initialization to ensure that the system, toolkit and wxWidgets are fully initialized.


OnPreInit()
Things that must be done after _BootstrapApp has done its thing, but would be nice if they were already done by the time that OnInit is called.

RedirectStdio(filename=None)

Redirect sys.stdout and sys.stderr to a file or a popup window.

Parameters:

  • filename (string)

RestoreStdio()
No docstrings available for this method.

SetOutputWindowAttributes(title=None, pos=None, size=None)

Set the title, position and/or size of the output window if the stdio has been redirected. This should be called before any output would cause the output window to be created.

Parameters: