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

==========================================================================================================================================
|phoenix_title|  **wx.Object**
==========================================================================================================================================

This is the root class of many of the wxWidgets classes.          

It declares a virtual destructor which ensures that destructors get called for all derived class objects where necessary. 

:ref:`wx.Object`  is the hub of a dynamic object creation scheme, enabling a program to create instances of a class only knowing its string class name, and to query the class hierarchy. 

The class contains optional debugging versions of **new**  and **delete**, which can help trace memory allocation and deallocation problems. 

:ref:`wx.Object`  can be used to implement :ref:`reference counted <reference counting>`  objects, such as :ref:`wx.Pen`, :ref:`wx.Bitmap`  and others (see :ref:`this list <stock items>`). See :ref:`wx.RefCounter`  and :ref:`Reference Counting <reference counting>`  for more info about reference counting. 







         



.. seealso:: :ref:`wx.ClassInfo`, :ref:`Debugging`, :ref:`Reference Counting <reference counting>`, ObjectDataRef, :ref:`wx.ObjectDataPtr`    







|

|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>Object</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.Object_inheritance.png" alt="Inheritance diagram of Object" 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.Object.html" title="wx.Object" alt="" coords="5,5,92,35"/> </map> 
   </p>
   </div>

|


|sub_classes| Known Subclasses
==============================

:ref:`wx.AcceleratorTable`, :ref:`wx.Accessible`, :ref:`wx.adv.Animation`, :ref:`ArchiveClassFactory`, :ref:`ArchiveEntry`, :ref:`wx.ArtProvider`, :ref:`AutomationObject`, :ref:`wx.BitmapHandler`, :ref:`Client`, :ref:`wx.Clipboard`, :ref:`wx.Colour`, :ref:`wx.ColourData`, :ref:`wx.propgrid.ColourPropertyValue`, :ref:`wx.Command`, :ref:`wx.CommandProcessor`, :ref:`wx.ConfigBase`, :ref:`Connection`, :ref:`ConnectionBase`, :ref:`wx.ContextHelp`, :ref:`wx.dataview.DataViewIconText`, :ref:`wx.dataview.DataViewRenderer`, :ref:`wx.DC`, :ref:`DDEClient`, :ref:`DocTemplate`, :ref:`wx.DragImage`, :ref:`EncodingConverter`, :ref:`wx.Event`, :ref:`wx.EvtHandler`, :ref:`wx.FileHistory`, :ref:`wx.FileSystem`, :ref:`wx.FileSystemHandler`, :ref:`FilterClassFactory`, :ref:`wx.FindReplaceData`, :ref:`wx.FontData`, :ref:`wx.FSFile`, :ref:`wx.GDIObject`, :ref:`wx.glcanvas.GLContext`, :ref:`wx.GraphicsObject`, :ref:`wx.GraphicsRenderer`, :ref:`wx.grid.GridTableBase`, :ref:`HashTable`, :ref:`wx.HelpControllerBase`, :ref:`wx.html.HtmlCell`, :ref:`wx.html.HtmlDCRenderer`, :ref:`wx.html.HtmlEasyPrinting`, :ref:`wx.html.HtmlFilter`, :ref:`wx.html.HtmlHelpData`, :ref:`wx.html.HtmlLinkInfo`, :ref:`wx.html.HtmlTagHandler`, :ref:`wx.Image`, :ref:`wx.ImageHandler`, :ref:`wx.ImageList`, :ref:`wx.IndividualLayoutConstraint`, :ref:`wx.adv.Joystick`, :ref:`wx.adv.LayoutAlgorithm`, :ref:`wx.LayoutConstraints`, :ref:`wx.ListItem`, :ref:`wx.Mask`, :ref:`wx.MenuItem`, :ref:`wx.Metafile`, :ref:`Module`, :ref:`wx.PageSetupDialog`, :ref:`wx.PageSetupDialogData`, :ref:`wx.propgrid.PGCell`, :ref:`wx.propgrid.PGEditor`, :ref:`wx.propgrid.PGEditorDialogAdapter`, :ref:`wx.propgrid.PGProperty`, :ref:`wx.PrintData`, :ref:`wx.PrintDialog`, :ref:`wx.PrintDialogData`, :ref:`wx.Printer`, :ref:`wx.Printout`, :ref:`wx.PrintPreview`, :ref:`Quantize`, :ref:`wx.RegionIterator`, :ref:`wx.richtext.RichTextAction`, :ref:`wx.richtext.RichTextDrawingContext`, :ref:`wx.richtext.RichTextDrawingHandler`, :ref:`wx.richtext.RichTextFieldType`, :ref:`wx.richtext.RichTextFileHandler`, :ref:`wx.richtext.RichTextFontTable`, :ref:`wx.richtext.RichTextFormattingDialogFactory`, :ref:`wx.richtext.RichTextHeaderFooterData`, :ref:`wx.richtext.RichTextImageBlock`, :ref:`wx.richtext.RichTextObject`, :ref:`wx.richtext.RichTextPrinting`, :ref:`wx.richtext.RichTextProperties`, :ref:`wx.richtext.RichTextRenderer`, :ref:`wx.richtext.RichTextStyleDefinition`, :ref:`wx.richtext.RichTextStyleSheet`, :ref:`wx.Sizer`, :ref:`wx.SizerItem`, :ref:`SockAddress`, :ref:`SocketBase`, :ref:`wx.adv.Sound`, :ref:`StringTokenizer`, :ref:`wx.SystemOptions`, :ref:`TCPClient`, :ref:`TCPConnection`, :ref:`TCPServer`, :ref:`wx.ToolBarToolBase`, :ref:`wx.ToolTip`, :ref:`URI`, :ref:`Variant`, :ref:`wx.html2.WebViewFactory`, :ref:`wx.xml.XmlDocument`, :ref:`wx.xrc.XmlResource`, :ref:`wx.xrc.XmlResourceHandler`

|


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

================================================================================ ================================================================================
:meth:`~wx.Object.__init__`                                                      Default constructor; initializes to ``None`` the internal reference data.
:meth:`~wx.Object.Destroy`                                                       Deletes the C++ object this Python object is a proxy for.
:meth:`~wx.Object.GetClassInfo`                                                  This virtual function is redefined for every class that requires run-time type information, when using the ``DECLARE_CLASS``  macro (or similar).
:meth:`~wx.Object.GetClassName`                                                  Returns the class name of the C++ class using ``RTTI``.
:meth:`~wx.Object.GetRefData`                                                    Returns the ``Object.m_refData``  pointer, i.e. the data referenced by this object.
:meth:`~wx.Object.IsSameAs`                                                      Returns ``True`` if this object has the same data pointer as `obj`.
:meth:`~wx.Object.Ref`                                                           Makes this object refer to the data in `clone`.
:meth:`~wx.Object.SetRefData`                                                    Sets the ``Object.m_refData``  pointer.
:meth:`~wx.Object.UnRef`                                                         Decrements the reference count in the associated data, and if it is zero, deletes the data.
:meth:`~wx.Object.UnShare`                                                       This is the same of :meth:`~Object.AllocExclusive`   but this method is public.
================================================================================ ================================================================================


|


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

================================================================================ ================================================================================
:attr:`~wx.Object.ClassInfo`                                                     See :meth:`~wx.Object.GetClassInfo`
:attr:`~wx.Object.ClassName`                                                     See :meth:`~wx.Object.GetClassName`
:attr:`~wx.Object.RefData`                                                       See :meth:`~wx.Object.GetRefData` and :meth:`~wx.Object.SetRefData`
================================================================================ ================================================================================


|


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


.. class:: wx.Object(object)

   **Possible constructors**::

       Object()
       
       Object(other)
       
   
   This is the root class of many of the wxWidgets classes.



   .. method:: __init__(self, *args, **kw)



      |overload| Overloaded Implementations:

      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self)`
      
      Default constructor; initializes to ``None`` the internal reference data.                   
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self, other)`
      
      Copy constructor.                  
      
      Sets the internal ``Object.m_refData``  pointer to point to the same instance of the ObjectRefData-derived class pointed by  ``other``   and increments the refcount of  ``Object.m_refData``.                  
      
      
      :param `other`: 
      :type `other`: wx.Object
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. method:: Destroy(self)

      Deletes the C++ object this Python object is a proxy for.  





   .. method:: GetClassInfo(self)

      This virtual function is redefined for every class that requires run-time type information, when using the ``DECLARE_CLASS``  macro (or similar).                  

      :rtype: :ref:`wx.ClassInfo`








   .. method:: GetClassName(self)

      Returns the class name of the C++ class using ``RTTI``. 

      :rtype: :ref:`wx.Char`








   .. method:: GetRefData(self)

      Returns the ``Object.m_refData``  pointer, i.e. the data referenced by this object.                  

                

      :rtype: :ref:`wx.ObjectRefData`







      .. seealso:: :meth:`Ref` , :meth:`UnRef` , ``Object.m_refData``, :meth:`SetRefData` , :ref:`wx.ObjectRefData`    








   .. method:: IsSameAs(self, obj)

      Returns ``True`` if this object has the same data pointer as `obj`.                  

      Notice that ``True`` is returned if the data pointers are ``None`` in both objects. 

      This function only does a `shallow`  comparison, i.e. it doesn't compare the objects pointed to by the data pointers of these objects. 

                


      :param `obj`: 
      :type `obj`: wx.Object




      :rtype: `bool`







      .. seealso:: :ref:`Reference Counting <reference counting>`    








   .. method:: Ref(self, clone)

      Makes this object refer to the data in `clone`.                  




      :param `clone`: The object to 'clone'.  
      :type `clone`: wx.Object




                  



      .. note:: 

         First this function calls :meth:`UnRef`   on itself to decrement (and perhaps free) the data it is currently referring to. It then sets its own ``Object.m_refData``  to point to that of `clone`, and increments the reference count inside the data.  







      .. seealso:: :meth:`UnRef` , :meth:`SetRefData` , :meth:`GetRefData` , :ref:`wx.ObjectRefData`    








   .. method:: SetRefData(self, data)

      Sets the ``Object.m_refData``  pointer.                  

                


      :param `data`: 
      :type `data`: wx.ObjectRefData






      .. seealso:: :meth:`Ref` , :meth:`UnRef` , :meth:`GetRefData` , :ref:`wx.ObjectRefData`    








   .. method:: UnRef(self)

      Decrements the reference count in the associated data, and if it is zero, deletes the data.                  

      The ``Object.m_refData``  member is set to ``None``. 

                 



      .. seealso:: :meth:`Ref` , :meth:`SetRefData` , :meth:`GetRefData` , :ref:`wx.ObjectRefData`    








   .. method:: UnShare(self)

      This is the same of :meth:`AllocExclusive`   but this method is public.                   





   .. attribute:: ClassInfo

      See :meth:`~wx.Object.GetClassInfo`


   .. attribute:: ClassName

      See :meth:`~wx.Object.GetClassName`


   .. attribute:: RefData

      See :meth:`~wx.Object.GetRefData` and :meth:`~wx.Object.SetRefData`

