The following code demonstrates a problem with certain wx cursors on Windows (OSX cursors have a white outline)... namely, they are all black, and therefore completely invisible on a black background.
import wx
app = wx.PySimpleApp()
f = wx.Frame(None)
f.SetBackgroundColour(wx.Color(0))
f.SetCursor(wx.StockCursor(wx.CURSOR_CROSS))
f.Show()
app.MainLoop()
I wonder if anyone has found a way to patch the windows icons, or if there is a fix for it that I am unaware of.
The more specific problem I am having is that matplotlibs' wx backend uses the wx.CURSOR_CROSS for zooming on imshow plots, which I am using to display images that are mostly black. I've yet to find a way to customize the cursors that mpl chooses, but I figured I'd pose the question while I dig.
Thanks, Adam
Note: Using wxPython version 2.8.10.1 and matplotlib versions 0.99 and 1.0
PROGRESS: I seem to be able to at least make my own cursor by doing the following, but I'm extremely frustrated to find that there is no way for me to include the color white anywhere. The documentation on this is horrendous.
import numpy as np
buf = np.ones((16,16,3), dtype='uint8') * 127 # pixels untouched by the following operations will outline the crosshair shape (wish they could be white)
buf[7,:,:] = 0 # horizontal black line
buf[:,7,:] = 0 # vertical black line
buf[:6,:6, :] = 255 # evidently values > 127 are interpreted as alpha
buf[9:,:6, :] = 255
buf[9:, 9:, :] = 255
buf[:6, 9:, :] = 255
im = wx.ImageFromBuffer(16, 16, buf.tostring()) # passing a separate alpha buffer just gets ignored
im.SetOptionInt(wx.IMAGE_OPTION_CUR_HOTSPOT_X, 7)
im.SetOptionInt(wx.IMAGE_OPTION_CUR_HOTSPOT_Y, 7)
cursor = wx.CursorFromImage(im)