Re: [PyQt] Problems with pyInstaller 2.0 and qt setWindowIcon Command
Am Mittwoch, 14. November 2012, 12:57:05 schrieb James Goss: > Hi All, > > > Wondering if anyone can help, > > Simple Qt Application: > |from PyQt4 import QtGui, QtCore > > import sys, atexit > > class ApplicationWindow(QtGui.QMainWindow): > def __init__(self): > QtGui.QMainWindow.__init__(self) > self.setAttribute(QtCore.Qt.WA_DeleteOnClose) > self.setWindowTitle("application main window") > self.file_menu= QtGui.QMenu('&File', self) > self.menuBar().addMenu(self.file_menu) > self.menuBar().addSeparator() > > self.main_widget= QtGui.QWidget(self) > > qApp= QtGui.QApplication(sys.argv) > aw= ApplicationWindow() > aw.show() > sys.exit(qApp.exec_()) > qApp.exec_()| > > Run's without a problem and I can build an exe using pyInstaller which > also runs fine. > > I add the lines: > |iconfile= QtGui.QIcon('C:/pyinstaller/img/image1.png') > > aw.setWindowIcon() | > > Just before aw.show() (also tried in other places throughout the code) > > This run's fine as a python file but when built using pyInstaller the > exe crashes at run-time, I've tried using resource files and other image > formats but the problem remains. Of course, you _need_ to use a resource file, that you compile with pyrcc4 and import accordingly. E.g. import test_rc [...] iconfile = QtGui.QIcon(':/image1.png') The test.qrc may look like: img/image1.png pyrcc4 -o test_rc.py test.qrc Having all resources included in one executable is the reason for pyinstallers existence.. Hth, Pete___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Problems with pyInstaller 2.0 and qt setWindowIcon Command
|iconfile= QtGui.QIcon('C:/pyinstaller/img/image1.png') aw.setWindowIcon(iconfile) | ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Problems with pyInstaller 2.0 and qt setWindowIcon Command
Apologies, typo, the added lines should read: |iconfile= QtGui.QIcon('C:/pyinstaller/img/image1.png') aw.setWindowIcon() | On 14/11/2012 12:57, James Goss wrote: Hi All, Wondering if anyone can help, Simple Qt Application: |from PyQt4 import QtGui, QtCore import sys, atexit class ApplicationWindow(QtGui.QMainWindow) : def __init__(self): QtGui.QMainWindow.__init__(self) self.setAttribute(< /span>QtCore.Qt.WA_DeleteOnClose) self.setWindowTitle ("application main window") self.file_menu= QtGui.QMenu('&File', self) self.menuBar().addMenu(self.file_menu) self.menuBar().addSeparator() self.main_widget=< /span> QtGui.QWidget (self) qApp= QtGui.QApplication(sys.argv) aw= ApplicationWindow() aw.show() sys.exit(qApp.exec_()) qApp.exec_()| Run's without a problem and I can build an exe using pyInstaller which also runs fine. I add the lines: |iconfile= QtGui.QIcon('C:/pyinstaller/img/image1.png') aw.setWindowIcon() | | Just before aw.show() (also tried in other places throughout the code) This run's fine as a python file but when built using pyInstaller the exe crashes at run-time, I've tried using resource files and other image formats but the problem remains. Can anyone help? Thanks | ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Problems with pyInstaller 2.0 and qt setWindowIcon Command
Hi All, Wondering if anyone can help, Simple Qt Application: |from PyQt4 import QtGui, QtCore import sys, atexit class ApplicationWindow(QtGui.QMainWindow): def __init__(self): QtGui.QMainWindow.__init__(self) self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.setWindowTitle("application main window") self.file_menu= QtGui.QMenu('&File', self) self.menuBar().addMenu(self.file_menu) self.menuBar().addSeparator() self.main_widget= QtGui.QWidget(self) qApp= QtGui.QApplication(sys.argv) aw= ApplicationWindow() aw.show() sys.exit(qApp.exec_()) qApp.exec_()| Run's without a problem and I can build an exe using pyInstaller which also runs fine. I add the lines: |iconfile= QtGui.QIcon('C:/pyinstaller/img/image1.png') aw.setWindowIcon() | Just before aw.show() (also tried in other places throughout the code) This run's fine as a python file but when built using pyInstaller the exe crashes at run-time, I've tried using resource files and other image formats but the problem remains. Can anyone help? Thanks ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt