You should copy qt.conf and plugins to your dist folder, the qt.conf like this: [Paths] Binaries = . Plugins = qtplugins I made a web scraping tool FMiner http://www.fminer.com and package using py2exe, it work fine on windows.
On Wed, Jun 22, 2011 at 8:11 PM, Chris Bartels <[email protected]>wrote: > This might not be the core topic of this list, but I think it's the best > place to put my question as it involves pyside internals. > > To be able to distribute a stand-alone program from a python script (that > uses pyside) I have tried the following tools: cxFreeze, py2exe and > pyinstaller. They generate executable files that start without errors. (i > found pyinstaller and cxFreeze to be the easiest to use...) > > But the standalone programs (all three!) seem to have a problem with > displaying images (png's seem to load fine, jpegs do not), whereas executing > the python script does not have these problems. > > This is strange, since the only dependancy of the program is pyside... (and > the pyside/qt dll's are copied to the distibutable directory) any clue of > what is going on here? > > I have compiled the following image viewer script below as a minimal > example: > > (One additional note: I tried copying -all- qt dll's into the executables > directory..) > > Kind regards, > C. > > > ------------------------------------------------------- Example image > viewer script > ------------------------------------------------------------------------------------------- > > import sys,random > from PySide import QtCore, QtGui > from PySide.QtGui import QStyle > from PySide.QtCore import Qt, QRectF, QPointF, QLineF > from PySide.QtGui import QColor, QCursor, QGraphicsRectItem, QGraphicsItem, > QGraphicsItemGroup, QGraphicsLineItem, QPixmap > from PySide.QtGui import QPen, QMainWindow, QMenu, QAction, QGraphicsView, > QGraphicsScene, QApplication, QFileDialog > > class MainWindow(QMainWindow): > > def loadImg(self): > self.imgfilename = QFileDialog.getOpenFileName(self,"Open > Image","", "Image Files (*.png *.jpg *.bmp)")[0] > self.imgpixmap = QPixmap( self.imgfilename ) > self.scene.clear() > self.scene.addPixmap(self.imgpixmap ) > > def zoomIn(self): > self.view.scale(2.0,2.0); > > def zoomOut(self): > self.view.scale(0.5,0.5); > > def __init__(self): > super(MainWindow, self).__init__() > > self.openAct = > QAction(self.style().standardIcon(QStyle.SP_DirOpenIcon) ,"&Open", > self, shortcut="Ctrl+O", triggered=self.loadImg) > self.exitAct = > QAction(self.style().standardIcon(QStyle.SP_DialogCloseButton),"E&xit", > self, shortcut="Ctrl+Q", triggered=self.close) > self.zoomInAct = QAction("Zoom In", self, shortcut="=", > triggered=self.zoomIn) > self.zoomOutAct = QAction("Zoom Out", self, shortcut="-", > triggered=self.zoomOut) > > self.menuView = QMenu("View") > self.menuView.addAction(self.zoomInAct) > self.menuView.addAction(self.zoomOutAct) > > self.menuFile = QMenu("File") > self.menuFile.addAction(self.openAct) > self.menuFile.addAction(self.exitAct) > > self.scene = QGraphicsScene(self) > self.view = QGraphicsView(self.scene,self) > self.view.setDragMode(QGraphicsView.ScrollHandDrag) > > self.menuBar().addMenu(self.menuFile) > self.menuBar().addMenu(self.menuView) > > self.setCentralWidget(self.view) > > self.setWindowTitle("Image Viewer") > self.show() > > def main(args): > app = QApplication(args) > w = MainWindow() > w.show() > sys.exit(app.exec_()) > > if __name__ == '__main__': > main(sys.argv) > > > > > > > > > > _______________________________________________ > PySide mailing list > [email protected] > http://lists.pyside.org/listinfo/pyside > >
_______________________________________________ PySide mailing list [email protected] http://lists.pyside.org/listinfo/pyside
