.. wxPython Phoenix documentation

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

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

.. include:: headings.inc



.. _wx.ActivateEvent:

==========================================================================================================================================
|phoenix_title|  **wx.ActivateEvent**
==========================================================================================================================================

An activate event is sent when a window or application is being activated or deactivated. 
         







.. _ActivateEvent-events:

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

Handlers bound for the following event types will receive a :ref:`wx.ActivateEvent` parameter.

 

- EVT_ACTIVATE: Process a  ``wxEVT_ACTIVATE``   event.   
- EVT_ACTIVATE_APP: Process a  ``wxEVT_ACTIVATE_APP``   event. This event is received by the App-derived instance only.   
- EVT_HIBERNATE: Process a hibernate event, supplying the member function. This event applies to :ref:`wx.App`  only, and only on Windows SmartPhone and PocketPC. It is generated when the system is low on memory; the application should free up as much memory as possible, and restore full working state when it receives a  ``wxEVT_ACTIVATE``   or   ``wxEVT_ACTIVATE_APP``   event.   









         



.. note:: 

   Until wxWidgets 3.1.0 activation events could be sent by wxMSW when the window was minimized. This reflected the native MSW behaviour but was often surprising and unexpected, so starting from 3.1.0 such events are not sent any more when the window is in the minimized state.  







.. seealso:: :ref:`Events and Event Handling <events and event handling>`, :meth:`wx.App.IsActive <wx.PyApp.IsActive>`     







|

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

.. raw:: html

   <div class="collabsible-wrapper">
      <input id="collapsible-inheritance" class="collapsible-checkbox" type="checkbox">
      <label for="collapsible-inheritance" tabindex="0" title="Show inheritance diagram" class="collapsible-label">Inheritance diagram for class <strong>ActivateEvent</strong>:</label>
      <div class="collapsible-content">
         <p class="graphviz">
            <center><img src="_static/images/inheritance/wx.ActivateEvent_inheritance.svg" alt="Inheritance diagram of ActivateEvent" usemap="#dummy" class="inheritance invert-in-dark-mode"/></center>
            <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.ActivateEvent.html" title="An activate event is sent when a window or application is being activated or deactivated." alt="" coords="5,159,156,188"/> <area shape="rect" id="node2" href="wx.Event.html" title="An event is a structure holding information about an event passed to a callback or member function." alt="" coords="34,82,128,111"/> <area shape="rect" id="node3" href="wx.Object.html" title="This is the root class of many of the wxWidgets classes." alt="" coords="31,5,130,34"/> </map> 
         </p>
      </div>
   </div>
   <script type="text/javascript" src="_static/inheritancetoggle.js"></script>



|


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

================================================================================ ================================================================================
:meth:`~wx.ActivateEvent.__init__`                                               Constructor.
:meth:`~wx.ActivateEvent.GetActivationReason`                                    Allows checking if the window was activated by clicking it with the mouse or in some other way.
:meth:`~wx.ActivateEvent.GetActive`                                              Returns ``True`` if the application or window is being activated, ``False`` otherwise.
================================================================================ ================================================================================


|


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

================================================================================ ================================================================================
:attr:`~wx.ActivateEvent.Active`                                                 See :meth:`~wx.ActivateEvent.GetActive`
================================================================================ ================================================================================


|


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


.. class:: wx.ActivateEvent(Event)

   **Possible constructors**::

       ActivateEvent(eventType=wxEVT_NULL, active=True, id=0,
                     ActivationReason=Reason_Unknown) -> None
       
   
   An activate event is sent when a window or application is being
   activated or deactivated.



   .. method:: __init__(self, eventType=wxEVT_NULL, active=True, id=0, ActivationReason=Reason_Unknown)

      Constructor. 
                 


      :param `eventType`: 
      :type `eventType`: wx.EventType
      :param `active`: 
      :type `active`: bool
      :param `id`: 
      :type `id`: int
      :param `ActivationReason`: 
      :type `ActivationReason`: wx.ActivateEvent.Reason




      :rtype: `None`     








   .. method:: GetActivationReason(self)

      Allows checking if the window was activated by clicking it with the mouse or in some other way. 
                 

      This method is currently only implemented in wxMSW and returns  ``Reason_Mouse``   there if the window was activated by a mouse click and   ``Reason_Unknown``   if it was activated in any other way (e.g. from keyboard or programmatically). 

      Under all the other platforms,  ``Reason_Unknown``   is always returned. 


                

      :rtype: :ref:`wx.ActivateEvent.Reason`







      .. versionadded:: 3.0   








   .. method:: GetActive(self)

      Returns ``True`` if the application or window is being activated, ``False`` otherwise. 
                 

      :rtype: `bool`








   .. attribute:: Active

      See :meth:`~wx.ActivateEvent.GetActive`


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

   wx.ActivateEvent.Reason.enumeration
