GeezerVison is showing docs.wxpython.org — wx.Object — wxPython 4.3.2 Docs
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.
Class Hierarchy¶
Inheritance diagram for class Object:
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, DDEClient , wx.dataview.DataViewIconText, wx.dataview.DataViewRenderer, DocTemplate , wx.DragImage, EncodingConverter , wx.Event, wx.EvtHandler, wx.FSFile, wx.FileHistory, wx.FileSystem, wx.FileSystemHandler, FilterClassFactory , wx.FindReplaceData, wx.FontData, 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.propgrid.PGCell, wx.propgrid.PGEditor, wx.propgrid.PGEditorDialogAdapter, wx.propgrid.PGProperty, wx.PageSetupDialog, wx.PageSetupDialogData, wx.PrintData, wx.PrintDialog, wx.PrintDialogData, wx.PrintPreview, wx.Printer, wx.Printout, Quantize , wx.ReadOnlyDC, 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
Methods Summary¶
__init__
|
Default constructor; initializes to nullptr 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. |
Properties Summary¶
Class API¶
-
class wx.Object(object)¶
Possible constructors:
Object() -> None
Object(other) -> None
This is the root class of many of the wxWidgets classes.
Methods¶
-
__init__(self, *args, **kw)¶
Overloaded Implementations:
__init__ (self)
Default constructor; initializes to nullptr the internal reference data.
- Return type:
None
__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)
- Return type:
None
-
Destroy(self)¶
Deletes the C++ object this Python object is a proxy for.
- Return type:
None
-
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:
str
-
GetRefData(self)¶
Returns the Object.m_refData pointer, i.e. the data referenced by this object.
- Return type:
wx.RefCounter
See also
wx.TipWindow.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 nullptr 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’.
- Return type:
None
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.
-
SetRefData(self, data)¶
Sets the Object.m_refData pointer.
- Parameters:
data (wx.ObjectRefData)
- Return type:
None
-
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 nullptr.
- Return type:
None
-
UnShare(self)¶
This is the same of AllocExclusive but this method is public.
- Return type:
None
Properties¶
-
ClassInfo¶
See GetClassInfo
-
ClassName¶
See GetClassName
-
RefData¶
See GetRefData and SetRefData
|