By default the art provider will pass wx.DefaultSize
to the CreateBitmap
method. That value is wx.Size(-1, -1)
so the bitmap created in ConvertToScaledBitmap
is invalid, and that is why the “Failed to gain raw access to bitmap data” exception happens.
So you should pass the desired size to wx.ArtProvider.GetIcon
or add some code like
if size == wx.DefaultSize:
...
to CreateBitmap
.