Passing other data formats

Passing bitmaps back and forth via the clipboard is nearly identical to passing text. The data object subclass you use is wx.BitmapDataObject, and its getter and setter are called GetBitmap() and SetBitmap(bitmap). The data passed to and from the clipboard via this data object must be of the type wx.Bitmap.

The final predefined data object type is wx.FileDataObject. Typically, this data object is used in drag and drop (discussed in section 18.2), such as when you drop a file from your Explorer or Finder window onto your application. You can use this data object to receive filename data from the clipboard, and you can retrieve the filenames from the data object with the method GetFilenames(), which returns a list of strings where each string is one filename that has been added to the clipboard. You can place data onto the clipboard using this data object using the method AddFile(file), which adds a filename string to the data object. There are no other methods to manipulate the list directly, so you're on your own if you want to perform other manipulations. Later in this chapter we'll discuss how to transfer custom objects via the clipboard, and how to drag and drop objects.

Was this article helpful?

0 0

Post a comment