How do I create a wx.Bitmap with a transparent background?

29 Views Asked by At

I want to create bitmaps for SBitmapButton() that are circles of various colours.

The exampel bitmap below creates a white background with a red circle on it.

How so I create a bitmap with a transparent background (i.e. no white rectangle) ?

Code:

p = 20     # bitmap side
c = 25    # background colour
r = 10     # circle radius
bitmap = wx.Bitmap(p, p, 32)
dc=wx.MemoryDC()
dc.SelectObject(bitmap)
dc.Clear()

dc.SetBrush(wx.Brush(wx.RED, wx.SOLID) )

pen=wx.Pen('red',1)
dc.SetPen(pen)
dc.DrawCircle(int(p/2), int(p/2), r)

dc.SelectObject(wx.NullBitmap)
0

There are 0 best solutions below