wx.CustomDataObject

Inheritance diagram for wx.CustomDataObject:



Description

wx.CustomDataObject is a specialization of wx.DataObjectSimple for some application-specific data in arbitrary (either custom or one of the standard ones). The only restriction is that it is supposed that this data can be copied bitwise (i.e. with memcpy()), so it would be a bad idea to make it contain a C++ object (though C struct is fine).

By default, wx.CustomDataObject stores the data inside in a buffer. To put the data into the buffer you may use either SetData or TakeData depending on whether you want the object to make a copy of data or not.

If you already store the data in another place, it may be more convenient and efficient to provide the data on-demand which is possible too if you override the virtual functions mentioned below.

See also

wx.DataObject

Properties Summary

Class API

Methods

__init__(format)

wx.CustomDataObject is a specialization of wx.DataObjectSimple for some application-specific data in arbitrary format.

Python strings are used for getting and setting data, but any picklable object can easily be transfered via strings. A copy of the data is stored in the data object.

Parameters:


Returns:

wx.CustomDataObject


GetData()

Returns a pointer to the data.


Returns:

PyObject


GetSize()

Returns the data size in bytes.


Returns:

long


TakeData(string)

Copy the data value to the data object.

Parameters:

  • string (string): This method expects a string in wxPython. You can pass nearly any object by pickling it first.

Returns:

bool


Properties

Data
See GetData and SetData
Size
See GetSize