1
我有一個函數用於在WXPython中創建一個矩形位圖。我想將其轉換爲圖像。然後回到一個位圖。怎麼會這樣呢?將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