All pastes #806109 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-12-04 23:29 UTC
rendered paste body
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)