.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2020 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc



.. _wx.PyApp:

==========================================================================================================================================
|phoenix_title|  **wx.PyApp**
==========================================================================================================================================

The :ref:`wx.App`  class represents the application itself when  ``USE_GUI=1`` .  
         

In addition to the features provided by :ref:`wx.AppConsole`  it keeps track of the `top window`  (see :meth:`~wx.PyApp.SetTopWindow`) and adds support for video modes (see :meth:`~wx.PyApp.SetDisplayMode`). 

In general, application-wide settings for GUI-only apps are accessible from :ref:`wx.App`  (or from :ref:`wx.SystemSettings`  or :ref:`wx.SystemOptions`  classes). 





.. _PyApp-events:

|events| Events Emitted by this Class
=====================================

Event macros for events emitted by this class: 

  

- EVT_QUERY_END_SESSION: Process a query end session event, supplying the member function. See :ref:`wx.CloseEvent`.  
- EVT_END_SESSION: Process an end session event, supplying the member function. See :ref:`wx.CloseEvent`.  
- EVT_ACTIVATE_APP: Process a  ``wxEVT_ACTIVATE_APP``   event. See  :ref:`wx.ActivateEvent`.  
- EVT_HIBERNATE: Process a hibernate event. See :ref:`wx.ActivateEvent`.  
- EVT_DIALUP_CONNECTED: A connection with the network was established. See `DialUpEvent`     .  
- EVT_DIALUP_DISCONNECTED: The connection with the network was lost. See `DialUpEvent`     .  
- EVT_IDLE: Process a  ``wxEVT_IDLE``   event. See  :ref:`wx.IdleEvent`.  









         



.. seealso:: :ref:`App Overview <app overview>`, :ref:`wx.AppTraits`, :ref:`wx.EventLoopBase`, :ref:`wx.SystemSettings`    







|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>PyApp</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.App_inheritance.svg" alt="Inheritance diagram of PyApp" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.App.html" title="The ``wx.App`` class represents the application and is used to:" alt="" coords="158,236,240,265"/> <area shape="rect" id="node2" href="wx.AppConsole.html" title="This class us used instead of wx.App  for console applications." alt="" coords="128,159,270,188"/> <area shape="rect" id="node3" href="wx.EvtHandler.html" title="A class that can handle events from the windowing system." alt="" coords="55,82,188,111"/> <area shape="rect" id="node4" href="wx.EventFilter.html" title="A global event filter for pre-processing all the events generated in the program." alt="" coords="211,82,341,111"/> <area shape="rect" id="node5" href="wx.Object.html" title="This is the root class of many of the wxWidgets classes." alt="" coords="5,5,104,34"/> <area shape="rect" id="node6" href="wx.Trackable.html" title="Add-on base class for a trackable object." alt="" coords="128,5,251,34"/> </map> 
   </p>
   </div>

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.PyApp.__init__`                                                       Constructor.
:meth:`~wx.PyApp.GTKAllowDiagnosticsControl`                                     Allows wxWidgets to selectively suppress some GTK messages.
:meth:`~wx.PyApp.GTKSuppressDiagnostics`                                         Disables the printing of various GTK messages.
:meth:`~wx.PyApp.GetAssertMode`                                                  Returns the current mode for how the application responds to  asserts.
:meth:`~wx.PyApp.GetComCtl32Version`                                             Returns 400, 470, 471, etc. for comctl32.dll 4.00, 4.70, 4.71 or 0 if
:meth:`~wx.PyApp.GetDisplayMode`                                                 Get display mode that is used use.
:meth:`~wx.PyApp.GetExitOnFrameDelete`                                           Returns ``True`` if the application will exit when the top-level frame is deleted.
:meth:`~wx.PyApp.GetLayoutDirection`                                             Return the layout direction for the current locale or  ``Layout_Default``   if it's unknown.
:meth:`~wx.PyApp.GetMainTopWindow`                                               Returns a pointer to the top application window if any.
:meth:`~wx.PyApp.GetTopWindow`                                                   Returns a pointer to the top window.
:meth:`~wx.PyApp.GetUseBestVisual`                                               Returns ``True`` if the application will use the best visual on systems that support different visuals, ``False`` otherwise.
:meth:`~wx.PyApp.IsActive`                                                       Returns ``True`` if the application is active, i.e. if one of its windows is currently in the foreground.
:meth:`~wx.PyApp.IsDisplayAvailable`                                             Returns True if the application is able to connect to the system's
:meth:`~wx.PyApp.MSWEnableDarkMode`                                              Enable experimental dark mode support for MSW applications.
:meth:`~wx.PyApp.MacHideApp`                                                     Hide all application windows just as the user can do with the
:meth:`~wx.PyApp.MacNewFile`                                                     Called in response of an "open-application" Apple event.
:meth:`~wx.PyApp.MacOpenFile`                                                    Called in response of an "open-document" Apple event.
:meth:`~wx.PyApp.MacOpenFiles`                                                   Called in response of an openFiles message.
:meth:`~wx.PyApp.MacOpenURL`                                                     Called in response of a "get-url" Apple event.
:meth:`~wx.PyApp.MacPrintFile`                                                   Called in response of a "print-document" Apple event.
:meth:`~wx.PyApp.MacReopenApp`                                                   Called in response of a "reopen-application" Apple event.
:meth:`~wx.PyApp.OSXEnableAutomaticTabbing`                                      Enable the automatic tabbing features of macOS.
:meth:`~wx.PyApp.OSXIsGUIApplication`                                            May be overridden to indicate that the application is not a foreground GUI application under macOS.
:meth:`~wx.PyApp.SafeYield`                                                      This function is similar to `wx.Yield`     , except that it disables the user input to all program windows before calling :meth:`wx.AppConsole.Yield`   and re-enables it again afterwards.
:meth:`~wx.PyApp.SafeYieldFor`                                                   Works like `wx.SafeYield`       with `onlyIfNeeded`  == ``True`` except that it allows the caller to specify a mask of events to be processed.
:meth:`~wx.PyApp.SetAppearance`                                                  Request using either system default or explicitly light or dark theme for the application.
:meth:`~wx.PyApp.SetAssertMode`                                                  Set the mode indicating how the application responds to  assertion
:meth:`~wx.PyApp.SetDisplayMode`                                                 Set display mode to use.
:meth:`~wx.PyApp.SetExitOnFrameDelete`                                           Allows the programmer to specify whether the application will exit when the top-level frame is deleted.
:meth:`~wx.PyApp.SetNativeTheme`                                                 Allows runtime switching of the UI environment theme.
:meth:`~wx.PyApp.SetTopWindow`                                                   Sets the 'top' window.
:meth:`~wx.PyApp.SetUseBestVisual`                                               Allows the programmer to specify whether the application will use the best visual on systems that support several visual on the same display.
================================================================================ ================================================================================


|


|property_summary| Properties Summary
=====================================

================================================================================ ================================================================================
:attr:`~wx.PyApp.AssertMode`                                                     See :meth:`~wx.PyApp.GetAssertMode` and :meth:`~wx.PyApp.SetAssertMode`
:attr:`~wx.PyApp.DisplayMode`                                                    See :meth:`~wx.PyApp.GetDisplayMode` and :meth:`~wx.PyApp.SetDisplayMode`
:attr:`~wx.PyApp.ExitOnFrameDelete`                                              See :meth:`~wx.PyApp.GetExitOnFrameDelete` and :meth:`~wx.PyApp.SetExitOnFrameDelete`
:attr:`~wx.PyApp.LayoutDirection`                                                See :meth:`~wx.PyApp.GetLayoutDirection`
:attr:`~wx.PyApp.TopWindow`                                                      See :meth:`~wx.PyApp.GetTopWindow` and :meth:`~wx.PyApp.SetTopWindow`
:attr:`~wx.PyApp.UseBestVisual`                                                  See :meth:`~wx.PyApp.GetUseBestVisual` and :meth:`~wx.PyApp.SetUseBestVisual`
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: wx.PyApp(AppConsole)

   **Possible constructors**::

       PyApp() -> None
       
   
   The App class represents the application itself when USE_GUI=1.



   .. method:: __init__(self)

      Constructor. 
                 

      Called implicitly with a definition of a :ref:`wx.App`  object. 
                 

      :rtype: `None`     








   .. staticmethod:: GTKAllowDiagnosticsControl()

      Allows wxWidgets to selectively suppress some GTK messages. 
                 

      This function can be called to allow wxWidgets to control GTK message logging. You must `not`  call it if your application calls the  ``g_log_set_writer_func()``   function itself, as this function can be only called once. 

      It is recommended to call this function in your overridden version of :meth:`wx.App.OnInit`   to allow wxWidgets to suppress some spurious GTK error messages, e.g. the ones that happen whenever :ref:`wx.Notebook`  pages are removed with the current GTK versions. 




                

      :rtype: `None`     







      .. versionadded:: 4.2/wxWidgets-3.2.1  
     







      .. availability:: Only available for GTK.  








   .. staticmethod:: GTKSuppressDiagnostics(flags=-1)

      Disables the printing of various GTK messages. 
                 

      This function can be called to suppress GTK diagnostic messages that are output on the standard error stream by default. 

      If  ``WXSUPPRESS_GTK_DIAGNOSTICS``   environment variable is set to a non-zero value, wxWidgets automatically calls this function on program startup with the value of this variable as  `flags`  if it's a number or with the default flags value otherwise. 

      The default value of the argument disables all messages, but you can pass in a mask flag to specifically disable only particular categories of messages. 

      Note that this function only works when using glib 2.50 (released in September 2016) or later and does nothing with the older versions of the library. 




      :param `flags`: The mask for the types of messages to suppress. Refer to the glib documentation for the  ``GLogLevelFlags``   enum, which defines the various message types.  
      :type `flags`: int






      :rtype: `None`     



      GTK port.  


                 



      .. versionadded:: 4.1/wxWidgets-3.1.6  
     







      .. availability:: Only available for GTK.  








   .. method:: GetAssertMode(self)

      Returns the current mode for how the application responds to  asserts. 

      :rtype: :ref:`wx.AppAssertMode`








   .. staticmethod:: 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. 

      :rtype: `int`








   .. method:: GetDisplayMode(self)

      Get display mode that is used use. 
                 

      This is only used in framebuffer wxWidgets ports such as wxDFB. 
                 

      :rtype: :ref:`wx.VideoMode`








   .. method:: GetExitOnFrameDelete(self)

      Returns ``True`` if the application will exit when the top-level frame is deleted. 
                 


                

      :rtype: `bool`







      .. seealso:: :meth:`SetExitOnFrameDelete`     








   .. method:: GetLayoutDirection(self)

      Return the layout direction for the current locale or  ``Layout_Default``   if it's unknown.  
                 

      :rtype: :ref:`wx.LayoutDirection`








   .. staticmethod:: GetMainTopWindow()

      Returns a pointer to the top application window if any. 
                 

      This function is safe to call even before creating, or after destroying, the application object, as it simply returns nullptr if it doesn't exist. Otherwise it's equivalent to calling  TheApp-> :meth:`GetTopWindow` . 


                

      :rtype: :ref:`wx.Window`







      .. versionadded:: 4.1/wxWidgets-3.1.5  
     








   .. method:: GetTopWindow(self)

      Returns a pointer to the top window. 
                 


                

      :rtype: :ref:`wx.Window`







      .. note:: 

         If the top window hasn't been set using :meth:`SetTopWindow` , this function will find the first top-level window (frame or dialog or instance of :ref:`wx.TopLevelWindow`) from the internal top level window list and return that.  







      .. seealso:: :meth:`SetTopWindow`     








   .. method:: GetUseBestVisual(self)

      Returns ``True`` if the application will use the best visual on systems that support different visuals, ``False`` otherwise. 
                 


                

      :rtype: `bool`







      .. seealso:: :meth:`SetUseBestVisual`     








   .. method:: IsActive(self)

      Returns ``True`` if the application is active, i.e. if one of its windows is currently in the foreground. 
                 

      If this function returns ``False`` and you need to attract users attention to the application, you may use :meth:`wx.TopLevelWindow.RequestUserAttention`   to do it. 
                 

      :rtype: `bool`








   .. staticmethod:: IsDisplayAvailable()

                      Returns True if the application is able to connect to the system's
                      display, or whatever the equivallent is for the platform. 

      :rtype: `bool`








   .. method:: MSWEnableDarkMode(self, flags=0, settings=nullptr)

      Enable experimental dark mode support for MSW applications. 
                 

      This function uses `undocumented`, and unsupported by Microsoft, functions to enable dark mode support for the desktop applications under Windows 10 versions later than v1809 (which includes Windows 10 ``LTSC`` 2019) and all Windows 11 versions. Please note that dark mode testing under versions of Windows earlier than ``20H1`` (i.e. v2004) has been limited, make sure to test your application especially carefully if you target these versions and want to enable dark mode support. 

      Note that dark mode can also be enabled by setting the "msw.dark-mode" :ref:`system option <wx.SystemOptions>`  via an environment variable from outside the application or by calling :meth:`SetAppearance`   with either  ``System``   or   ``Dark``   parameter. 

      Known limitations of dark mode support include: 



      - Anything based on  ``TaskDialog()``   Win32 API doesn't support dark mode:  `wx.MessageBox`     , :ref:`wx.MessageDialog`, :ref:`wx.RichMessageDialog`, :ref:`wx.ProgressDialog`  and simple (i.e., without hyperlink or licence) `wx.adv.AboutBox`     . Consider using generic versions (e.g. GenericMessageDialog or :ref:`wx.GenericProgressDialog`) if dark mode support is more important than using the native dialog. 
      - The following dialogs wrapping common windows dialogs don't support dark mode: :ref:`wx.ColourDialog`, :ref:`wx.FindReplaceDialog`, :ref:`wx.FontDialog`, :ref:`wx.PageSetupDialog`, :ref:`wx.PrintDialog`. 
      - :ref:`wx.adv.TimePickerCtrl`, :ref:`wx.adv.DatePickerCtrl`  and :ref:`wx.adv.CalendarCtrl`  don't support dark mode and use the same (light) background as by default in it. 
      - Toolbar items for which :meth:`wx.ToolBar.SetDropdownMenu`   was called don't draw the menu drop-down correctly, making it almost invisible. 
      - Calling :meth:`wx.Menu.Break`   or :meth:`wx.MenuItem.SetDisabledBitmap`   will result in the menu being light. 







      :param `flags`: Can include  ``App::DarkMode_Always``   to force enabling dark mode for the application, even if the system doesn't use the dark mode by default. Otherwise dark mode is only used if it is the default mode for the applications on the current system.    
      :type `flags`: int
      :param `settings`: If specified, allows to customize dark mode appearance. Please see :ref:`wx.DarkModeSettings`  documentation for more information.  
      :type `settings`: wx.DarkModeSettings








      :rtype: `bool`







                 



      :returns: 

         ``True`` if dark mode support was enabled, ``False`` if it couldn't be done, most likely because the system doesn't support dark mode.  







      .. versionadded:: 4.3/wxWidgets-3.3.0  
     







      .. availability:: Only available for MSW.  








   .. method:: MacHideApp(self)

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

      :rtype: `None`     








   .. method:: MacNewFile(self)

      Called in response of an "open-application" Apple event. 
                 

      Override this to create a new document in your app. 

                 


      :rtype: `None`     







      .. availability:: Only available for OSX.  








   .. method:: MacOpenFile(self, fileName)

      Called in response of an "open-document" Apple event. 
                 



                 



      :param `fileName`: 
      :type `fileName`: string




      :rtype: `None`     







      .. wxdeprecated:: 
         This function is kept mostly for backwards compatibility. Please override :meth:`wx.App.MacOpenFiles <wx.PyApp.MacOpenFiles>`   method instead in any new code.   







      .. availability:: Only available for OSX.  








   .. method:: MacOpenFiles(self, fileNames)

      Called in response of an openFiles message. 
                 

      You need to override this method in order to open one or more document files after the user double clicked on it or if the files and/or folders were dropped on either the application in the dock or the application icon in Finder. 

      By default this method calls MacOpenFile for each file/folder. 




                


      :param `fileNames`: 
      :type `fileNames`: list of strings




      :rtype: `None`     







      .. versionadded:: 2.9.3 
     







      .. availability:: Only available for OSX.  








   .. method:: MacOpenURL(self, url)

      Called in response of a "get-url" Apple event. 
                 

                 



      :param `url`: 
      :type `url`: string




      :rtype: `None`     







      .. availability:: Only available for OSX.  








   .. method:: MacPrintFile(self, fileName)

      Called in response of a "print-document" Apple event. 
                 

                 



      :param `fileName`: 
      :type `fileName`: string




      :rtype: `None`     







      .. availability:: Only available for OSX.  








   .. method:: MacReopenApp(self)

      Called in response of a "reopen-application" Apple event. 
                 

                 


      :rtype: `None`     







      .. availability:: Only available for OSX.  








   .. method:: OSXEnableAutomaticTabbing(self, enable)

      Enable the automatic tabbing features of macOS. 
                 

      This feature is native to the operating system. When it is enabled, macOS will automatically place windows inside tabs and show a tab bar in the application. Entries are also added to the View menu to show/hide the tab bar. 




                


      :param `enable`: 
      :type `enable`: bool




      :rtype: `None`     







      .. versionadded:: 4.1/wxWidgets-3.1.4  
     







      .. note:: 

         Requires macOS 10.12+, does nothing under earlier OS versions.  







      .. availability:: Only available for OSX.  








   .. method:: OSXIsGUIApplication(self)

      May be overridden to indicate that the application is not a foreground GUI application under macOS. 
                 

      This method is called during the application startup and returns ``True`` by default. In this case, wxWidgets ensures that the application is ran as a foreground, GUI application so that the user can interact with it normally, even if it is not bundled. If this is undesired, i.e. if the application doesn't need to be brought to the foreground, this method can be overridden to return ``False``. 

      Notice that overriding it doesn't make any difference for the bundled applications which are always foreground unless  ``LSBackgroundOnly``   key is specified in the   ``Info.plist``   file. 




                

      :rtype: `bool`







      .. versionadded:: 4.0/wxWidgets-3.0.1  
     







      .. availability:: Only available for OSX.  








   .. method:: SafeYield(self, win, onlyIfNeeded)

      This function is similar to `wx.Yield`     , except that it disables the user input to all program windows before calling :meth:`wx.AppConsole.Yield`   and re-enables it again afterwards. 
                 

      If `win`  is not nullptr, this window will remain enabled, allowing the implementation of some limited user interaction. Returns the result of the call to :meth:`wx.AppConsole.Yield` . 


                


      :param `win`: 
      :type `win`: wx.Window
      :param `onlyIfNeeded`: 
      :type `onlyIfNeeded`: bool




      :rtype: `bool`







      .. seealso:: `wx.SafeYield`         








   .. method:: SafeYieldFor(self, win, eventsToProcess)

      Works like `wx.SafeYield`       with `onlyIfNeeded`  == ``True`` except that it allows the caller to specify a mask of events to be processed. 
                 

      See :meth:`wx.EventLoopBase.YieldFor`   for more info. 
                 


      :param `win`: 
      :type `win`: wx.Window
      :param `eventsToProcess`: 
      :type `eventsToProcess`: long




      :rtype: `bool`








   .. method:: SetAppearance(self, appearance)

      Request using either system default or explicitly light or dark theme for the application. 
                 

      Under GTK and macOS applications use the system default appearance by default, and so it is only useful to call this function with either :meth:`wx.PyApp.Appearance.Light`   or :meth:`wx.PyApp.Appearance.Dark`   parameters if you need to override the default system appearance. The effect of calling this function is immediate, i.e. this function returns :meth:`wx.PyApp.AppearanceResult.Ok` , and affects all the existing windows as well as any windows created after this call. 

      Under MSW, the default appearance is always light and the applications that want to follow the system appearance need to explicitly call this function with :meth:`wx.PyApp.Appearance.System`   parameter in order to do it. Please note using dark appearance under MSW requires using non-documented system functions and has several known limitations, please see :meth:`MSWEnableDarkMode`   for more details. Also, on this platform the appearance can be only set before any windows are created and calling this function too late will return :meth:`wx.PyApp.AppearanceResult.CannotChange` . 

      Note that to query the current appearance, you can use :ref:`wx.SystemAppearance`, see :meth:`wx.SystemSettings.GetAppearance` . 


                


      :param `appearance`: 
      :type `appearance`: wx.PyApp.Appearance




      :rtype: :ref:`wx.PyApp.AppearanceResult`







      :returns: 

         :meth:`wx.PyApp.AppearanceResult.Ok`   if the appearance was successfully changed or had been already set to the requested value, :meth:`wx.PyApp.AppearanceResult.CannotChange`   if the appearance can't be changed any more because it's too late to do it but could be changed if done immediately on next program launch (only returned by wxMSW currently) or :meth:`wx.PyApp.AppearanceResult.Failure`   if changing the appearance failed for some other reason, e.g. because  ``GTK_THEME``   is defined when using wxGTK of this function is not implemented at all for the current platform.  







      .. versionadded:: 4.3/wxWidgets-3.3.0  
     








   .. method:: SetAssertMode(self, wxAppAssertMode)

                      Set the mode indicating how the application responds to  assertion
                      statements. Valid settings are a combination of these flags:

                              - wx.``wx.APP_ASSERT_SUPPRESS``
                              - wx.``wx.APP_ASSERT_EXCEPTION``
                              - wx.``wx.APP_ASSERT_DIALOG``
                              - wx.``wx.APP_ASSERT_LOG``

                      The default behavior is to raise a wx.wxAssertionError exception.
                 


      :param `wxAppAssertMode`: 
      :type `wxAppAssertMode`: wx.AppAssertMode




      :rtype: `None`     








   .. method:: SetDisplayMode(self, info)

      Set display mode to use. 
                 

      This is only used in framebuffer wxWidgets ports such as wxDFB. 
                 


      :param `info`: 
      :type `info`: wx.VideoMode




      :rtype: `bool`








   .. method:: SetExitOnFrameDelete(self, flag)

      Allows the programmer to specify whether the application will exit when the top-level frame is deleted. 
                 




      :param `flag`: If ``True`` (the default), the application will exit when the top-level frame is deleted. If ``False``, the application will continue to run.  
      :type `flag`: bool






      :rtype: `None`     




                  



      .. seealso:: :meth:`GetExitOnFrameDelete` , :ref:`Application Shutdown <application shutdown>`    








   .. method:: SetNativeTheme(self, theme)

      Allows runtime switching of the UI environment theme. 
                 

      Currently implemented for GTK2-only. Return ``True`` if theme was successfully changed. 




      :param `theme`: The name of the new theme or an absolute path to a gtkrc-theme-file   
      :type `theme`: string






      :rtype: `bool`




                  





   .. method:: SetTopWindow(self, window)

      Sets the 'top' window. 
                 

      You can call this from within :meth:`~wx.AppConsole.OnInit`   to let wxWidgets know which is the main window. You don't have to set the top window; it is only a convenience so that (for example) certain dialogs without parents can use a specific window as the top window. 

      If no top window is specified by the application, wxWidgets just uses the first frame or dialog (or better, any :ref:`wx.TopLevelWindow`) in its top-level window list, when it needs to use the top window. If you previously called :meth:`SetTopWindow`   and now you need to restore this automatic behaviour you can call  ``App::SetTopWindow(nullptr)`` . 




      :param `window`: The new top window.  
      :type `window`: wx.Window






      :rtype: `None`     




                  



      .. seealso:: :meth:`GetTopWindow` , :meth:`~wx.AppConsole.OnInit`     








   .. method:: SetUseBestVisual(self, flag, forceTrueColour=False)

      Allows the programmer to specify whether the application will use the best visual on systems that support several visual on the same display. 
                 

      This is typically the case under Solaris and ``IRIX``, where the default visual is only 8-bit whereas certain applications are supposed to run in TrueColour mode. 

      Note that this function has to be called in the constructor of the :ref:`wx.App`  instance and won't have any effect when called later on. This function currently only has effect under GTK. 




      :param `flag`: If ``True``, the app will use the best visual.   
      :type `flag`: bool
      :param `forceTrueColour`: If ``True`` then the application will try to force using a TrueColour visual and abort the app if none is found.   
      :type `forceTrueColour`: bool








      :rtype: `None`     




                  





   .. attribute:: AssertMode

      See :meth:`~wx.PyApp.GetAssertMode` and :meth:`~wx.PyApp.SetAssertMode`


   .. attribute:: DisplayMode

      See :meth:`~wx.PyApp.GetDisplayMode` and :meth:`~wx.PyApp.SetDisplayMode`


   .. attribute:: ExitOnFrameDelete

      See :meth:`~wx.PyApp.GetExitOnFrameDelete` and :meth:`~wx.PyApp.SetExitOnFrameDelete`


   .. attribute:: LayoutDirection

      See :meth:`~wx.PyApp.GetLayoutDirection`


   .. attribute:: TopWindow

      See :meth:`~wx.PyApp.GetTopWindow` and :meth:`~wx.PyApp.SetTopWindow`


   .. attribute:: UseBestVisual

      See :meth:`~wx.PyApp.GetUseBestVisual` and :meth:`~wx.PyApp.SetUseBestVisual`


.. toctree::
   :maxdepth: 1
   :hidden:

   wx.PyApp.Appearance.enumeration
   wx.PyApp.AppearanceResult.enumeration
