wx.PyApp

Inheritance diagram for wx.PyApp:



Class API

Methods

__init__()

Create a new application object, starting the bootstrap process.


Returns:

wx.PyApp


Dispatch()

Process the first event in the event queue (blocks until an event appears if there are none currently).


Returns:

bool


Exit()
Exit the main loop thus terminating the application.

See also

wx.Exit


ExitMainLoop()
Exit the main GUI loop during the next iteration of the main loop, (i.e. it does not stop the program immediately!).

GetAppName()

Get the application name.


Returns:

string


GetAssertMode()

Get the current OnAssert behaviour setting.


Returns:

int


GetComCtl32Version()

Returns 400, 470, 471, etc. for comctl32.dll 4.00, 4.70, 4.71 or 0 if it wasn’t found at all.

Raises an exception on non-Windows platforms.


Returns:

int


GetExitOnFrameDelete()

Get the current exit behaviour setting.


Returns:

bool


GetLayoutDirection()

Return the layout direction for the current locale.


Returns:

int


GetMacAboutMenuItemId()
No docstrings available for this method.

GetMacExitMenuItemId()
No docstrings available for this method.

GetMacHelpMenuTitleName()
No docstrings available for this method.

GetMacPreferencesMenuItemId()
No docstrings available for this method.

GetMacSupportPCMenuShortcuts()
No docstrings available for this method.

GetPrintMode()
No docstrings available for this method.

GetTopWindow()

Return the main top level window (if it hadn’t been set previously with SetTopWindow, will return just some top level window and, if there not any, will return None)


Returns:

wx.Window


GetTraits()

Return (and create if necessary) the app traits object to which we delegate for everything which either should be configurable by the user (then he can change the default behaviour simply by overriding CreateTraits and returning his own traits object) or which is GUI/console dependent as then wx.AppTraits allows us to abstract the differences behind the common facade.


Returns:

wx.AppTraits

todo:Add support for overriding CreateAppTraits in wxPython.

GetUseBestVisual()

Get current UseBestVisual setting.


Returns:

bool


GetVendorName()

Get the application’s vendor name.


Returns:

string


IsActive()

Return True if our app has focus.


Returns:

bool


IsDisplayAvailable()

Tests if it is possible to create a GUI in the current environment.

This will mean different things on the different platforms:

  • On X Windows systems this function will return False if it is not able to open a connection to the X display, which can happen if $DISPLAY is not set, or is not set correctly.
  • On Mac OS X a False return value will mean that wxPython is not able to access the window manager, which can happen if logged in remotely or if running from the normal version of python instead of the framework version (i.e., pythonw).
  • On MS Windows...

Returns:

bool


IsMainLoopRunning()

Returns True if we’re running the main loop, i.e. if the events can currently be dispatched.


Returns:

bool


MacHideApp()
Hide all application windows just as the user can do with the system Hide command. Mac only.

MacRequestUserAttention()
No docstrings available for this method.

MainLoop()

Execute the main GUI loop, the function doesn’t normally return until all top level windows have been closed and destroyed.


Returns:

int


Pending()

Returns True if there are unprocessed events in the event queue.


Returns:

bool


ProcessIdle()

Called from the MainLoop when the application becomes idle (there are no pending events) and sends a wx.IdleEvent to all interested parties.

Returns True if more idle events are needed, False if not.


Returns:

bool


SendIdleEvents(win, event)

Send idle event to window and all subwindows.

Returns True if more idle time is requested.

Parameters:


Returns:

bool


SetAppName(name)

Set the application name. This value may be used automatically by wx.Config and such.

Parameters:

  • name (string)

SetAssertMode(mode)

Set the OnAssert behaviour for debug and hybrid builds.

Parameters:

  • mode (int)

SetClassName(name)

Set the application’s class name.

This value may be used for X-resources if applicable for the platform

Parameters:

  • name (string)

SetExitOnFrameDelete(flag)

Control the exit behaviour: by default, the program will exit the main loop (and so, usually, terminate) when the last top-level program window is deleted. Beware that if you disable this behaviour (with SetExitOnFrameDelete (False)), you’ll have to call ExitMainLoop explicitly from somewhere.

Parameters:

  • flag (bool)

SetMacAboutMenuItemId(val)

Parameters:

  • val (long)

SetMacExitMenuItemId(val)

Parameters:

  • val (long)

SetMacHelpMenuTitleName(val)

Parameters:

  • val (string)

SetMacPreferencesMenuItemId(val)

Parameters:

  • val (long)

SetMacSupportPCMenuShortcuts(val)

Parameters:

  • val (bool)

SetPrintMode(mode)

Parameters:

  • mode (int)

SetTopWindow(win)

Set the main top level window.

Parameters:


SetUseBestVisual(flag, forceTrueColour=False)

Set whether the app should try to use the best available visual on systems where more than one is available (Sun, SGI, XFree86 4, etc...)

Parameters:

  • flag (bool)
  • forceTrueColour (bool)

SetVendorName(name)

Set the application’s vendor name. This value may be used automatically by wx.Config and such.

Parameters:

  • name (string)

WakeUpIdle()
Make sure that idle events are sent again.

See also

wx.WakeUpIdle


Yield(onlyIfNeeded=False)

Process all currently pending events right now, instead of waiting until return to the event loop. It is an error to call Yield recursively unless the value of onlyIfNeeded is True.

Parameters:

  • onlyIfNeeded (bool)

Returns:

bool

Warning

This function is dangerous as it can lead to unexpected reentrancies (i.e. when called from an event handler it may result in calling the same event handler again), use with extreme care or, better, don’t use at all!


Properties

Active
Return True if our app has focus.
AppName
See GetAppName and SetAppName
AssertMode
See GetAssertMode and SetAssertMode
ExitOnFrameDelete
See GetExitOnFrameDelete and SetExitOnFrameDelete
LayoutDirection
See GetLayoutDirection
PrintMode
See GetPrintMode and SetPrintMode
TopWindow
See GetTopWindow and SetTopWindow
Traits
See GetTraits
UseBestVisual
See GetUseBestVisual and SetUseBestVisual
VendorName
See GetVendorName and SetVendorName