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.

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.

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

See also

wx.ClassInfo, Debugging , Reference Counting, ObjectDataRef, wx.ObjectDataPtr


class_hierarchy Class Hierarchy

Inheritance diagram for class Object:

sub_classes Known Subclasses

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


method_summary Methods Summary

__init__

Default constructor; initializes to None the internal reference data.

Destroy

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

GetClassInfo

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

GetClassName

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

GetRefData

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

IsSameAs

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

Ref

Makes this object refer to the data in clone.

SetRefData

Sets the Object.m_refData pointer.

UnRef

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

UnShare

This is the same of AllocExclusive but this method is public.


property_summary Properties Summary

ClassInfo

See GetClassInfo

ClassName

See GetClassName

RefData

See GetRefData and SetRefData


api Class API

class wx.Object(object)

Possible constructors:

Object()

Object(other)

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


Methods

__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.

Parameters:

other (wx.Object) –





Destroy(self)

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



GetClassInfo(self)

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

Return type:

wx.ClassInfo



GetClassName(self)

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

Return type:

wx.Char



GetRefData(self)

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

Return type:

wx.ObjectRefData

See also

Ref , UnRef , Object.m_refData, SetRefData , wx.ObjectRefData



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.

Parameters:

obj (wx.Object) –

Return type:

bool



Ref(self, clone)

Makes this object refer to the data in clone.

Parameters:

clone (wx.Object) – The object to ‘clone’.

Note

First this function calls 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.

See also

UnRef , SetRefData , GetRefData , wx.ObjectRefData



SetRefData(self, data)

Sets the Object.m_refData pointer.

Parameters:

data (wx.ObjectRefData) –

See also

Ref , UnRef , GetRefData , wx.ObjectRefData



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.

See also

Ref , SetRefData , GetRefData , wx.ObjectRefData



UnShare(self)

This is the same of AllocExclusive but this method is public.


Properties

ClassInfo

See GetClassInfo



ClassName

See GetClassName



RefData

See GetRefData and SetRefData