Hello everybody,
after diving into Tkinter for a while I'm now willing to learn PyQt. Before spending a lot of time with it I tried to process a very simple script (displaying a plain window) with Pyinstaller. This because I absolutely need to share my app with different people which will not install any python or modules. However my resulting .exe file doesn't work. Can anyone help me?
Here's the python script

import PyQt4
import sys
from PyQt4 import QtGui

class HelloWindow(QtGui.QMainWindow):

    def __init__(self, win_parent = None):
        #Init the base class
        QtGui.QMainWindow.__init__(self, win_parent)

app = QtGui.QApplication(sys.argv)
#The Main window
main_window = HelloWindow()
main_window.show()
# Enter the main loop
app.exec_()


here's my .spec file

a = Analysis([os.path.join(HOMEPATH,'support\\_mountzlib.py'), os.path.join(HOMEPATH,'support\\useUnicode.py'), '000.py'],
pathex=)
pyz = PYZ(a.pure)
exe = EXE( pyz,
a.scripts,
a.binaries,
name='000.exe',
debug=1,
strip=False,
upx=False,
console=1 )

here's finally the warning coming along with the .exe file

W: no module named posix (conditional import by os)
W: no module named org (top-level import by copy)
W: no module named posix (delayed, conditional import by iu)
W: no module named pwd (delayed, conditional import by posixpath)
W: no module named _emx_link (conditional import by os)
W: delayed __import__ hack detected at line 0 - encodings (C:\Python25\lib\encodings\__init__.pyc)
W: delayed eval hack detected at line 0 - os (C:\Python25\lib\os.pyc)
W: delayed conditional exec statement detected at line 0 - iu (C:\Python25\pyinstaller-1.3\iu.pyc)
W: delayed conditional exec statement detected at line 0 - iu (C:\Python25\pyinstaller-1.3\iu.pyc)

Thanks

If you have Windows machines, then it is much simpler to distribute your PyQT programs on an inexpensive USB Flash Drive. A 256MB drive will do, they cost just a few dollars.

Follow this procedures on one drive, you can then make copies from there:

Let's assume you have used PyQt-Py2.5-gpl-4.4.2-1.exe (free download from:
http://pyqwt.sourceforge.net/download.html) to install PyQT on C:\Python25

Let's further assume you have used PortablePython1.0.zip (free download from:
http://www.portablepython.com/) and extracted its files to flashdrive G.

To make PyQT work on PortablePython1.0 copy the following files:
C:\Python25\Lib\site-packages\PyQt4 to G:\PortablePython1.0\Lib\site-packages\PyQt4
C:\Python25\Lib\site-packages\sip.pyd to G:\PortablePython1.0\Lib\site-packages\sip.pyd
C:\Python25\Lib\site-packages\sipconfig.py to G:\PortablePython1.0\Lib\site-packages\ sipconfig.py
C:\Python25\Lib\site-packages\sipdistutils.py to G:\PortablePython1.0\Lib\site-packages\sipdistutils.py

Now run one of the PYQT testfiles in the SciTE.exe IDE that accompanies PortablePython1.0

Here is one of the test programs:

# pqt_checkbox1.py

import sys
from PyQt4 import QtGui
from PyQt4 import QtCore


class CheckBox(QtGui.QWidget):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)

        self.setGeometry(300, 300, 250, 150)
        self.setWindowTitle('Checkbox')

        self.cb = QtGui.QCheckBox('Show title', self)
        self.cb.setFocusPolicy(QtCore.Qt.NoFocus)
        self.cb.move(10, 10)
        self.cb.toggle();
        self.connect(self.cb, QtCore.SIGNAL('stateChanged(int)'), self.changeTitle)

    def changeTitle(self, value):
        if self.cb.isChecked():
            self.setWindowTitle('Checkbox')
        else:
            self.setWindowTitle('')

app = QtGui.QApplication(sys.argv)
icon = CheckBox()
icon.show()
app.exec_()

PortablePython1.0.zip includes:
Portable Python 1.0 BETA
Python 2.5
Django 0.96 - Revision 4293 (08 january 2007)
Scite 1.71

Thank you very much for your clever suggestion sneekula.
That's something which can be very handy indeed.
But what I'd need is to have let's say an .exe file to be downloadable from ftp and install on the user machine.
Therefore my question is: is it possible to compile a python app which include PyQt libraries with Pyinstaller or Py2Exe or whatever other tool which provides me with such a functionality?
Thanks again so much for your help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.