Question on creating and setting custom cursors

I have a wrapper class that provides resizing and dragging
functionality to widgets on a canvas. Under Linux, the stock cursors
for wxCURSOR_SIZENESW & wxCURSOR_SIZENWSE are broken and only display
the movement (4 arrow) cursor. I've been trying to create a custom
cursor for these two that I will display if the application is running
under GTK. I've been attempting two approaches, both of which have
failed.

Approach 1 - Use the system cursors on my machine - eg:
        nwseCursor = wx.Cursor("/usr/share/icons/Bluecurve/cursors/
top_left_corner", wx.BITMAP_TYPE_ANY)

The problem is, I don't can't get the file to be recognized by wx.
The "file" command reports the icon is of type GLS_BINARY_LSB_FIRST.
I've pretty much exhausted the file type argument of wxCursor's
constructor and haven't gotten any to work.

Approach 2 - Use a .cur file downloaded from the internet. The issue
I'm having here is that when I create the cursor, the colors are
inverted. For a black cursor with a white outline, the cursor
displayed in my app is white with a black outline. I've played around
with the mask, but can't get it to show up correctly. Here are a
couple of my latest failed attempts:
            #Mouse icon shows up white with black outline
            image2 = wx.Image(os.path.join(path, "top-left-
corner.cur"), wx.BITMAP_TYPE_CUR)
            nwseCursor = wx.CursorFromImage(image2)

            #Mouse icon shows up white with gray outline
            image2 = wx.Image(os.path.join(path, "top-left-
corner.cur"), wx.BITMAP_TYPE_CUR)
            image2.ConvertAlphaToMask()
            nwseCursor = wx.CursorFromImage(image2)

The underlying constructor in wxWidgets has this note about creating a
cursor from an image: "In wxGTK, colour cursors and alpha channel are
supported (starting from GTK+ 2.2). Otherwise the two most frequent
colors will be used for foreground and background. In any case, the
cursor will be displayed at the size of the image."

As shown in the demo you can create a cursor from a wx.Image with wx.CursorFromImage, so you should be able to create your cursor images as ordinary PNG files and load them into cursors as shown there.

···

On 11/19/09 10:42 AM, Mears wrote:

I have a wrapper class that provides resizing and dragging
functionality to widgets on a canvas. Under Linux, the stock cursors
for wxCURSOR_SIZENESW& wxCURSOR_SIZENWSE are broken and only display
the movement (4 arrow) cursor. I've been trying to create a custom
cursor for these two that I will display if the application is running
under GTK. I've been attempting two approaches, both of which have
failed.

--
Robin Dunn
Software Craftsman