【问题标题】:Converting WXpython Bitmap to an Image, then Back Again将 WXpython 位图转换为图像,然后再返回
【发布时间】:2011-06-20 09:53:07
【问题描述】:

我有一个在 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

【问题讨论】:

    标签: python image bitmap wxpython


    【解决方案1】:

    使用wx.ImageFromBitmap(bitmap)wx.BitmapFromImage(image)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-24
      • 1970-01-01
      • 1970-01-01
      • 2017-06-04
      • 1970-01-01
      • 2017-04-29
      相关资源
      最近更新 更多