Package wx :: Class PyDataObjectSimple
[frames | no frames]

Type PyDataObjectSimple

  object --+        
           |        
  DataObject --+    
               |    
DataObjectSimple --+
                   |
                  PyDataObjectSimple


wx.PyDataObjectSimple is a version of wx.DataObjectSimple that is Python-aware and knows how to reflect calls to its C++ virtual methods to methods in the Python derived class. You should derive from this class and overload GetDataSize, GetDataHere and SetData when you need to create your own simple single-format type of wx.DataObject.

Here is a simple example:

class MyDataObject(wx.PyDataObjectSimple):
    def __init__(self):
        wx.PyDataObjectSimple.__init__(
            self, wx.CustomDataFormat('MyDOFormat'))
        self.data = ''

    def GetDataSize(self):
        return len(self.data)
    def GetDataHere(self):
        return self.data  # returns a string  
    def SetData(self, data):
        self.data = data
        return True

Note that there is already a wx.CustomDataObject class that behaves very similarly to this example. The value of creating your own derived class like this is to be able to do additional things when the data is requested or given via the clipboard or drag and drop operation, such as generate the data value or decode it into needed data structures.


Method Summary
PyDataObjectSimple __init__(self, format)
wx.PyDataObjectSimple is a version of wx.DataObjectSimple that is Python-aware and knows how to reflect calls to its C++ virtual methods to methods in the Python derived class.

Property Summary
  thisown: The membership flag

Class Variable Summary

Method Details

__init__(self, format=FormatInvalid)
(Constructor)

wx.PyDataObjectSimple is a version of wx.DataObjectSimple that is Python-aware and knows how to reflect calls to its C++ virtual methods to methods in the Python derived class. You should derive from this class and overload GetDataSize, GetDataHere and SetData when you need to create your own simple single-format type of wx.DataObject.

Here is a simple example:

class MyDataObject(wx.PyDataObjectSimple):
    def __init__(self):
        wx.PyDataObjectSimple.__init__(
            self, wx.CustomDataFormat('MyDOFormat'))
        self.data = ''

    def GetDataSize(self):
        return len(self.data)
    def GetDataHere(self):
        return self.data  # returns a string  
    def SetData(self, data):
        self.data = data
        return True

Note that there is already a wx.CustomDataObject class that behaves very similarly to this example. The value of creating your own derived class like this is to be able to do additional things when the data is requested or given via the clipboard or drag and drop operation, such as generate the data value or decode it into needed data structures.

Parameters:
format
           (type=DataFormat)

Returns:
PyDataObjectSimple
Overrides:
wx.DataObjectSimple.__init__

Property Details

thisown

The membership flag


Generated by Epydoc 2.1.20050511.rpd on Thu Mar 22 12:12:12 2007 http://epydoc.sf.net