.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2018 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 ` objects, such as :ref:`wx.Pen`, :ref:`wx.Bitmap` and others (see :ref:`this list `). See :ref:`wx.RefCounter` and :ref:`Reference Counting ` for more info about reference counting.
.. seealso:: :ref:`wx.ClassInfo`, `Debugging` , :ref:`Reference Counting `, ObjectDataRef, `ObjectDataPtr`
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html

Inheritance diagram for class
Object:
|
|sub_classes| Known Subclasses
==============================
:ref:`wx.AcceleratorTable`, :ref:`wx.Accessible`, :ref:`wx.adv.Animation`, `ArchiveClassFactory` , `ArchiveEntry` , :ref:`wx.ArtProvider`, `AutomationObject` , `wx.BitmapHandler` , `Client` , :ref:`wx.Clipboard`, :ref:`wx.Colour`, :ref:`wx.ColourData`, :ref:`wx.propgrid.ColourPropertyValue`, :ref:`wx.Command`, :ref:`wx.CommandProcessor`, :ref:`wx.ConfigBase`, `Connection` , `ConnectionBase` , :ref:`wx.ContextHelp`, :ref:`wx.dataview.DataViewIconText`, :ref:`wx.dataview.DataViewRenderer`, :ref:`wx.DC`, `DDEClient` , `DocTemplate` , :ref:`wx.DragImage`, `EncodingConverter` , :ref:`wx.Event`, :ref:`wx.EvtHandler`, :ref:`wx.FileHistory`, :ref:`wx.FileSystem`, :ref:`wx.FileSystemHandler`, `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`, `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`, `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`, `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`, `SockAddress` , `SocketBase` , :ref:`wx.adv.Sound`, `StringTokenizer` , :ref:`wx.SystemOptions`, `TCPClient` , `TCPConnection` , `TCPServer` , :ref:`wx.ToolBarToolBase`, :ref:`wx.ToolTip`, `URI` , `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:
**~~~**
**__init__** `(self)`
Default constructor; initializes to ``None`` the internal reference data.
**~~~**
**__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
**~~~**
.. 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: `wx.Char`
.. method:: GetRefData(self)
Returns the ``Object.m_refData`` pointer, i.e. the data referenced by this object.
:rtype: `wx.ObjectRefData`
.. seealso:: :meth:`Ref` , :meth:`UnRef` , ``Object.m_refData``, :meth:`SetRefData` , `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 `
.. 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` , `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` , `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` , `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`