2012-07-27 24 views
0

我已經使用python和wxpython創建了一個程序。我使用py2exe創建了一個可執行文件。 IT工作正常,但我已將我的公司徽標用作飛濺屏幕和印刷圖紙。我不得不刪除splashscreen以使可執行文件正常工作。在錯誤的文本文件,我得到以下幾點:可執行文件將不包含用於wxpython的圖像

Traceback (most recent call last): File "printGland.pyc", line 418, in OnPrintPage File "wx_gdi.pyc", line 3459, in DrawBitmap wx._core.PyAssertionError: C++ assertion "bmp.Ok()" failed at ....\src\msw\dc.cpp(1181) in wxDC::DoDrawBitmap(): invalid bitmap in wxDC::DrawBitmap

我假設BMP圖像沒有被包含在可執行文件。加載時代碼有問題嗎?

def __init__(self,parent,id): 
    # Splash Screen 
    image = wx.Image("Image.bmp",wx.BITMAP_TYPE_BMP) 
    bmp = image.ConvertToBitmap() 
    wx.SplashScreen(bmp,wx.SPLASH_CENTRE_ON_SCREEN|wx.SPLASH_TIMEOUT,1000,None,-1) 
    wx.Yield() 

或者當我使用py2exe時,它應該添加到安裝文件中?有關如何糾正這種情況的任何想法?

+0

其中的wxPython的版本? – Babu 2012-07-27 06:31:09

+0

從錯誤很明顯,你傳遞一個無效的BMP文件。 – Babu 2012-07-27 06:36:10

+0

wxpython是2.8。 「無效的bmp文件」是什麼意思? – 2012-07-27 06:47:18

回答

0

reference

Is the image file present in the current working directory? You'll probably need to specify the path that the image file is located in rather than just assuming the CWD as you've given.

更多的討論,here

相關問題