下面给出的是我在Python 2.6中运行代码时遇到的错误(在我以前的帖子wx Import Error中)。谁能告诉这个错误?我无法理解。
Traceback (most recent call last):
File "C:\Python26\music_player_v1\player_skeleton.py", line 153, in <module>
frame = MediaFrame()
File "C:\Python26\music_player_v1\player_skeleton.py", line 148, in __init__
panel = MediaPanel(self)
File "C:\Python26\music_player_v1\player_skeleton.py", line 25, in __init__
self.layoutControls()
File "C:\Python26\music_player_v1\player_skeleton.py", line 46, in layoutControls
audioTBSizer = self.buildAudioToolBar()
File "C:\Python26\music_player_v1\player_skeleton.py", line 65, in buildAudioToolBar
self.rewind = SBitmapButton(self, -1, upbmp, (48, 48))
File "C:\Python26\Lib\wx-2.8-msw-unicode\wx\lib\agw\shapedbutton.py", line 995, in __init__
self.SetBitmapLabel(bitmap)
File "C:\Python26\Lib\wx-2.8-msw-unicode\wx\lib\agw\shapedbutton.py", line 1068, in SetBitmapLabel
image = wx.ImageFromBitmap(bitmap)
File "C:\Python26\Lib\wx-2.8-msw-unicode\wx\_core.py", line 3473, in ImageFromBitmap
val = _core_.new_ImageFromBitmap(*args, **kwargs)
PyAssertionError: C++ assertion "bmp.Ok()" failed at ..\..\src\msw\dib.cpp(148) in wxDIB::Create(): wxDIB::Create(): invalid bitmap
答案 0 :(得分:1)
不确定这是否与您的问题完全相关,但SWIG生成的包装器不会保留传递给wx中任何set*()
方法之类的任何Python对象。您需要自己保留这些物体,否则您将遇到奇怪的错误。
答案 1 :(得分:0)
看起来你的位图无效。在阅读追溯时,它通常是最有用的底部追溯,而且这个追溯说你有一个&#34;无效的位图&#34;。
答案 2 :(得分:0)
您的应用程序无法找到图像文件,将所有图像放在一个文件中,并在您的代码中提供找到图像的确切路径。这将解决该错误。