Step Create drop source instance

The next step is to create an instance of wx.DropSource, which is the object that will play a transfer role analogous to that of the clipboard. The constructor for wx.DropSource is.

wx.DropSource(win, iconCopy=wx.NullIconOrCursor, iconMove=wx.NullIconOrCursor, iconNone=wx.NullIconOrCursor)

The win argument is the window object which initiates the drag and drop operation. The other three parameters allow you to customize the graphic used as the mouse is dragged for locations that will result in a copy, in a move, and where the drop is not allowed. If not specified, system defaults will be used. The graphics need to be wx.Cursor objects on MS Windows systems, but are wx.lcon objects on Unix—the Mac OS currently ignores your custom graphic.

Once you have your wx.DropSource instance, associate your data object to it with the method SetData(data). Next, we'll describe the actual drag.

Was this article helpful?

0 0

Post a comment