开发者

How to merge (join) two wx.bitmap using wxpython?

开发者 https://www.devze.com 2023-01-03 22:14 出处:网络
I have one wx.emptybitmap (1) and one wx.bitmap (2). I want to merge(join) them.. I want to create a single wx.bitmap that consists on the wx.emptybitmap (1) on the top and wx.bitmap (2) on the botto

I have one wx.emptybitmap (1) and one wx.bitmap (2). I want to merge(join) them..

I want to create a single wx.bitmap that consists on the wx.emptybitmap (1) on the top and wx.bitmap (2) on the bottom.

How can I开发者_StackOverflow中文版 do that?

Thanks in advance! :D


After a lot of web searching here it is :)

The code is something like that!

    empty = wx.EmptyBitmap(parent.imageWidth,12+parent.imageHeight)
    dc = wx.MemoryDC()
    dc.SelectObject(empty)
    dc.SetTextForeground(parent.colorFont)
    dc.SetPen(wx.Pen('WHITE', 1))
    dc.DrawLine(0, 3, parent.imageWidth, 3)
    dc.DrawLine(0, 6, parent.imageWidth, 6)
    dc.DrawLine(0, 9, parent.imageWidth, 9)
    dc.DrawBitmap(imageSmall[len(imageSmall)-1], 0, 12, True)
    dc.SelectObject(wx.NullBitmap)

    wx.StaticBitmap.__init__(self, parent, id, bitmap=empty, pos=(position[0], position[1]), size=(parent.imageWidth, parent.imageHeight))


You could always use PIL, it has a function to do this. Save the image in memory and convert it into an wx.Bitmap.

0

精彩评论

暂无评论...
验证码 换一张
取 消