如何使用wxpython合并(连接)两个wx.bitmap?

发布于 2024-09-06 19:06:19 字数 164 浏览 7 评论 0原文

我有一张 wx.emptybitmap (1) 和一张 wx.bitmap (2)。我想合并(加入)它们..

我想创建一个wx.bitmap,它由顶部的wx.emptybitmap(1)和底部的wx.bitmap(2)组成。

我怎样才能做到这一点?

提前致谢! :D

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 do that?

Thanks in advance! :D

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

若言繁花未落 2024-09-13 19:06:19

经过大量的网络搜索后,它是:)

代码是这样的!

    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))

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))
执笔绘流年 2024-09-13 19:06:19

你总是可以使用 PIL,它有一个函数可以做到这一点。将图像保存在内存中并将其转换为wx.Bitmap。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文