From: Robin Dunn Date: Tue, 17 May 2005 00:27:11 +0000 (+0000) Subject: Added wx.DROP_ICON() X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/f66cece3800700d49ae3541b401900582aeed065?ds=inline Added wx.DROP_ICON() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34085 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/wxPython/src/_dnd.i b/wxPython/src/_dnd.i index bfe497b58e..29a4d2cc19 100644 --- a/wxPython/src/_dnd.i +++ b/wxPython/src/_dnd.i @@ -88,6 +88,21 @@ public: }; +%pythoncode { +def DROP_ICON(filename): + """ + Returns either a `wx.Cursor` or `wx.Icon` created from the image file + ``filename``. This function is useful with the `wx.DropSource` class + which, depending on platform accepts either a icon or a cursor. + """ + img = wx.Image(filename) + if wx.Platform == '__WXGTK__': + return wx.IconFromBitmap(wx.BitmapFromImage(img)) + else: + return wx.CursorFromImage(img) +} + + //--------------------------------------------------------------------------- // wxDropTarget should be associated with a window if it wants to be able to