【发布时间】:2019-04-03 17:21:30
【问题描述】:
好的,所以我在这里迷路了,我们将不胜感激。我有一个程序可以显示给定时间范围内的所有晶圆图。[下图]当我输入日期 9/1/18- 9/15/18 时,它输出正常。当我做 9/15/18-9/30/18 时,它也可以正常工作,但是当我查询整个月时,我得到一个错误。我开始认为这可能是与内存相关的问题,但我对内存不太了解。我知道python自己处理内存。此外,我确实有 16GB 的 RAM 并使用 64 位架构。该设置是一个 GUI,允许您选择一个文件并选择 2 个日期,然后出现另一个 wx.frame,显示晶圆图。
查询较大日期时收到的错误如下
image = bitmap.ConvertToImage()
wx._core.wxAssertionError: C++ assertion "hbmp" failed at ..\..\src\msw\dib.cpp(139) in wxDIB::Create(): wxDIB::Create(): invalid bitmap
这里是被调用的父函数
def SetBitmapLabel(self, bitmap, createOthers=True):
"""
Set the bitmap to display normally.
This is the only one that is required.
If `createOthers` is ``True``, then the other bitmaps will be generated
on the fly. Currently, only the disabled bitmap is generated.
:param wx.Bitmap `bitmap`: the bitmap for the normal button appearance.
.. note:: This is the bitmap used for the unselected state, and for all other
states if no other bitmaps are provided.
"""
self.bmpLabel = bitmap
if bitmap is not None and createOthers:
image = bitmap.ConvertToImage()
imageutils.grayOut(image)
self.SetBitmapDisabled(wx.Bitmap(image))
上面的函数在这里被调用
def SetBitmap(self, bmp):
"""
Sets the bitmap representation of the current selected colour to the button.
:param wx.Bitmap `bmp`: the new bitmap.
"""
self.SetBitmapLabel(bmp)
self.Refresh()
任何帮助将不胜感激,因为此时我不知道从这里去哪里。也许正在工作的 GUI 只能在 32 位下运行?不确定。不确定是否需要图像,但在下面
编辑 感谢下面的人,我发现发生这种情况的原因是因为我的 GDI 对象达到了 10,000 个脚本,这是 Windows 设置的限制。现在我必须为此找到解决方法。可能会发布另一个问题来深入探讨这个
【问题讨论】:
-
仔细检查 wxwidgets 组件标签的名称以及图像路径。
-
它在较短的查询中起作用但在较大的查询中失败的任何原因?就标签名称和图像路径而言?
-
看起来你的内存肯定用完了。
标签: python python-3.x memory-management wxpython wxwidgets