How to create wx.Bitmap from "xpm data"?

HI Grant,

The obvious answer would be it's what's in an .xpm file, but
that doesn't work. I've tried manipulating the contents of the
.xpm file a half-dozen different ways, but no matter what I
try, wx.Bitmap() always returns a bitmap with a size of -1,-1
instead of 24,24.

What's the expected format of "XPM data" for wx.Bitmap()?

Something along these lines:

check_mark_xpm = [" 16 16 16 1",
                  "` c #000000",
                  ". c #800000",
                  "# c #008000",
                  "a c #808000",
                  "b c #000080",
                  "c c #800080",
                  "d c #008080",
                  "e c #808080",
                  "f c #c0c0c0",
                  "g c #ff0000",
                  "h c #00ff00",
                  "i c #ffff00",
                  "j c #0000ff",
                  "k c #ff00ff",
                  "l c #00ffff",
                  "m c #ffffff",
                  "mmmmmmmmmmmmmmmm",
                  "mmmmmmmmmm`mmmmm",
                  "mmmmmmmmm``mmmmm",
                  "mmmm`mmm```mmmmm",
                  "mmmm``m```mmmmmm",
                  "mmmm`````mmmmmmm",
                  "mmmmm```mmmmmmmm",
                  "mmmmmm`mmmmmmmmm",
                  "mmmmmmmmmmmmmmmm",
                  "mmmmmmmmmmmmmmmm"
                  ]

myBitmap = wx.BitmapFromXPMData(check_mark_xpm)

Should work and do what you ask :wink:

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

···

On 5/2/07, Grant Edwards wrote: