我有一个用于在WXPython中创建矩形位图的函数。我想把它转换成图像。然后回到位图。怎么会这样呢?
摘录:
def make_shape(self, w, h, r ):
maskc = wx.Color(0, 0, 0)
shownc = wx.Color(0, 0, 1)
bitmap = wx.EmptyBitmap(w, h)
dc = wx.MemoryDC(bitmap)
# Fill
dc.SetBrush(wx.Brush(shownc))
# Rounding
dc.SetPen(wx.Pen(shownc))
# Shape
dc.DrawRoundedRectangle(0, 0, w, h, r)
dc.SelectObject(wx.NullBitmap)
bitmap.SetMaskColour(maskc)
return bitmap
答案 0 :(得分:2)
使用wx.ImageFromBitmap(bitmap)
和wx.BitmapFromImage(image)