empty = ['\x00' in xrange(10**6)] def transparent_bitmap(w, h): image = wx.EmptyImage(w, h) image.InitAlpha() alpha = image.GetAlphaBuffer() if len(alpha) < len(empty): alpha[:] = empty[:len(alpha)] else: for i in xrange(len(alpha)): alpha[i] = '\x00' return wx.BitmapFromImage(image)