The wx.Bitmap class encapsulates the concept of a platform-dependent bitmap, either monochrome or colour. Platform-specific methods for creating a wx.Bitmap object from an existing file are catered for.
A bitmap created dynamically or loaded from a file can be selected into a memory device context (an instance of wx.MemoryDC). This enables the bitmap to be copied to a window or memory device context using :meth:`wx.DC.Blit`(), or to be used as a drawing surface.
See also
wx.MemoryDC for an example of drawing onto a bitmap.
All wxPython platforms support XPMs for small bitmaps and icons.
The following lists the formats handled on different platforms. Note that missing or partially-implemented formats are automatically supplemented by using wx.Image to load the data, and then converting it to wx.Bitmap form. Note that using wx.Image is the preferred way to load images in wxPython, with the exception of resources (XPM-files or native Windows resources).
Under Windows, wx.Bitmap may load the following formats:
wx.BITMAP_TYPE_BMP_RESOURCE
)wx.BITMAP_TYPE_BMP
)wx.BITMAP_TYPE_XPM
)Under wxGTK, wx.Bitmap may load the following formats:
wx.BITMAP_TYPE_XPM
)Under wxMotif and wxX11, wx.Bitmap may load the following formats:
wx.BITMAP_TYPE_XBM
)wx.BITMAP_TYPE_XPM
)Under Windows, wx.Icon may load the following formats:
wx.BITMAP_TYPE_ICO_RESOURCE
)wx.BITMAP_TYPE_ICO
)wx.BITMAP_TYPE_XPM
)Under wxGTK, wx.Icon may load the following formats:
wx.BITMAP_TYPE_XPM
)Under Windows, wx.Cursor may load the following formats:
wx.BITMAP_TYPE_CUR_RESOURCE
)wx.BITMAP_TYPE_CUR
)wx.BITMAP_TYPE_ICO
)wx.BITMAP_TYPE_BMP
)Under wxGTK, wx.Cursor may load the following formats (in addition to stock cursors):