Package wx :: Class App
[frames | no frames]

Type App

object --+            
         |            
    Object --+        
             |        
    EvtHandler --+    
                 |    
             PyApp --+
                     |
                    App

Known Subclasses:
App, App, App, App, App, App, PySimpleApp, PyWidgetTester

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

Every application must have a wx.App instance, and all creation of UI objects should be delayed until after the wx.App object has been created in order to ensure that the gui platform and wxWidgets have been fully initialized.

Normally you would derive from this class and implement an OnInit method that creates a frame and then calls self.SetTopWindow(frame).


See Also:

wx.PySimpleApp for a simpler app class that can be used directly.

Method Summary
  __init__(self, redirect, filename, useBestVisual, clearSigInt)
Construct a wx.App object.
  __del__(self, destroy)
  Destroy(self)
  MainLoop(self)
Execute the main GUI event loop
  RedirectStdio(self, filename)
Redirect sys.stdout and sys.stderr to a file or a popup window.
  RestoreStdio(self)
  SetOutputWindowAttributes(self, title, pos, size)
Set the title, position and/or size of the output window if the stdio has been redirected.
  SetTopWindow(self, frame)
Set the "main" top level window
    Inherited from PyApp
  __repr__(self)
bool Dispatch(self)
Process the first event in the event queue (blocks until an event appears if there are none currently)
  Exit(self)
Exit the main loop thus terminating the application.
  ExitMainLoop(self)
Exit the main GUI loop during the next iteration of the main loop, (i.e.
String GetAppName(self)
Get the application name.
int GetAssertMode(self)
Get the current OnAssert behaviour setting.
String GetClassName(self)
Get the application's class name.
int GetComCtl32Version()
Returns 400, 470, 471, etc. (Static method)
bool GetExitOnFrameDelete(self)
Get the current exit behaviour setting.
long GetMacAboutMenuItemId()
(Static method)
long GetMacExitMenuItemId()
(Static method)
String GetMacHelpMenuTitleName()
(Static method)
long GetMacPreferencesMenuItemId()
(Static method)
bool GetMacSupportPCMenuShortcuts()
(Static method)
int GetPrintMode(self)
Window GetTopWindow(self)
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)
wxAppTraits GetTraits(self)
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.
bool GetUseBestVisual(self)
Get current UseBestVisual setting.
String GetVendorName(self)
Get the application's vendor name.
bool IsActive(self)
Return True if our app has focus.
bool IsMainLoopRunning()
Returns True if we're running the main loop, i.e. (Static method)
bool Pending(self)
Returns True if there are unprocessed events in the event queue.
bool ProcessIdle(self)
Called from the MainLoop when the application becomes idle (there are no pending events) and sends a wx.IdleEvent to all interested parties.
  ProcessPendingEvents(self)
Process all events in the Pending Events list -- it is necessary to call this function to process posted events.
bool SendIdleEvents(self, win, event)
Send idle event to window and all subwindows.
  SetAppName(self, name)
Set the application name.
  SetAssertMode(self, mode)
Set the OnAssert behaviour for debug and hybrid builds.The following flags may be or'd together:
  SetClassName(self, name)
Set the application's class name.
  SetExitOnFrameDelete(self, 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.
  SetMacAboutMenuItemId(val)
(Static method)
  SetMacExitMenuItemId(val)
(Static method)
  SetMacHelpMenuTitleName(val)
(Static method)
  SetMacPreferencesMenuItemId(val)
(Static method)
  SetMacSupportPCMenuShortcuts(val)
(Static method)
  SetPrintMode(self, mode)
  SetUseBestVisual(self, flag)
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.)
  SetVendorName(self, name)
Set the application's vendor name.
  WakeUpIdle(self)
Make sure that idle events are sent again.
bool Yield(self, onlyIfNeeded)
Process all currently pending events right now, instead of waiting until return to the event loop.
    Inherited from EvtHandler
  AddPendingEvent(self, event)
  Bind(self, event, handler, source, id, id2)
Bind an event to an event handler.
  Connect(self, id, lastId, eventType, func)
bool Disconnect(self, id, lastId, eventType)
bool GetEvtHandlerEnabled(self)
EvtHandler GetNextHandler(self)
EvtHandler GetPreviousHandler(self)
bool ProcessEvent(self, event)
  SetEvtHandlerEnabled(self, enabled)
  SetNextHandler(self, handler)
  SetPreviousHandler(self, handler)
  Unbind(self, event, source, id, id2)
Disconencts the event handler binding for event from self.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
Return hash(x)...
  __new__(T, S, ...)
Return a new object with type S, a subtype of T...
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
Return str(x)...

Class Variable Summary
classobj outputWindowClass = wx.PyOnDemandOutputWindow

Instance Method Details

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

Construct a wx.App object.

Parameters:
redirect - 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 - The name of a file to redirect output to, if redirect is True.

useBestVisual - 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 - Should SIGINT be cleared? This allows the app to terminate upon a Ctrl-C in the console like other GUI apps will.

Overrides:
wx.PyApp.__init__

Note:

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

MainLoop(self)

Execute the main GUI event loop

Overrides:
wx.PyApp.MainLoop

RedirectStdio(self, filename=None)

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

SetOutputWindowAttributes(self, 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.

SetTopWindow(self, frame)

Set the "main" top level window

Overrides:
wx.PyApp.SetTopWindow

Generated by Epydoc 2.1.20050511.rpd on Sat Jun 16 16:45:37 2007 http://epydoc.sf.net