使用cx_freeze后,QGraphicsPixmapItem不会出现

Bro*_* S. 2 python pyqt4 cx-freeze python-3.x

我无法理解为什么在使用cx_freeze构建应用程序后我的QGraphicsPixmapItem没有出现.该类和cx_freeze是否有任何已知问题,或者我错过了cx_freeze的一些设置?以下是创建和显示QGraphicsPixmapItem的部分,之后是我的cx_freeze的setup.py:

def partNo_changed(self):
    self.scene.removeItem(self.previewItem)
    partNumber = self.ui.partNo.text()
    fileLocation = 'drawings\\FULL\\%s.svg' % partNumber
    print(fileLocation)
    pixmap = QtGui.QPixmap(fileLocation)
    self.previewItem = QtGui.QGraphicsPixmapItem(pixmap)
    self.previewItem.setPos(0, 0)
    self.scene.addItem(self.previewItem)
    self.ui.svgPreview.centerOn(self.previewItem)
Run Code Online (Sandbox Code Playgroud)

这是setup.py脚本:

from cx_Freeze import setup, Executable

files = ['drawings\\FULL']

setup(
        name = 'DBManager',
        version = '1.0',
        description = 'Makes and maintains the .csv database files.',
        author = 'Brock Seabaugh',
        options = {'build_exe': {'include_files':files, 'bin_path_includes':files}},
        executables = [Executable('dbManager_publicDB.py')])
Run Code Online (Sandbox Code Playgroud)

其他所有东西都在程序中运行,这是唯一不起作用的东西(如果我只运行.py脚本,它会起作用,但是当我运行exe时却不行).我构建或运行exe时没有错误.如果有人可以帮助解决这个问题,那就太棒了.我正在使用Python v3.1和cx_freeze v4.2.3以及PyQt v4.

Bro*_* S. 5

所以我找到了问题的答案.显然问题不在于QGraphicsPixmapItem类,它与应用程序的QtSvg部分有关.因为cx_freeze的输出显示在创建可执行文件时包含了QtSvg模块,所以这让我失望,但这并不是程序所需要的.它还需要qt.conf文件.我要解决的问题是找到'...\Python31\Lib\site-packages\PyQt4\bin\qt.conf'中的qt.conf文件并将该文件复制到应用程序可执行文件的目录中是的,瞧,它的确有效!