[PyQt] Deploying a PyQt4 application on Windows using py2exe

Kevin Cureton kevin at bang-splat.com
Fri Mar 23 19:26:27 GMT 2007


The first imports the module QtCore into the current namespace as  
QtCore. For instance, to create a QtFile object you would write:

from PyQt4 import QtCore
foo = QtCore.QFile()

The second imports all the stuff in QtCore into the module namespace.  
In this case you would create a QFile this way:

from PyQt4.QtCore import *
foo = QFile()

There is a third alternative, which is

import PyQt4.QtCore

in which case you'd create a QFile like this:

foo = PyQt4.QtCore.QFile()

I personally use the first form (from PyQt4 import QtCore). It the  
names moderately short and let's me easily locate the Qt code.

--kev

--
kevin at bang-splat dot com
The tools for managing paradox are still undeveloped. --Kevin Kelly



On Mar 23, 2007, at 1:56 AM, Curzio Basso wrote:

> 2007/3/23, Luper Rouch <luper.rouch at gmail.com>:
>> Tony Cappellini a écrit :
>> > from distutils.core import setup
>> > import py2exe
>> >
>> > setup(windows=[{"script":"main.pyw"}], options={"py2exe":
>> > {"includes":["sip"]}} )
>> >
>> > python setup.py py2exe
>> >
>> Well all I can say is that an equivalent setup works for me, with  
>> these
>> versions :
>> python-2.5
>> py2exe-0.6.5
>> PyQt-4.1.1
>> qt-4.2.3
>>
>> I looked into library.zip, QtCore.pyc and QtGui.pyc are also ~500
>> bytes... I don't think your problem is related to PyQt :-)
>
> might be the way it is imported? what happens using
>
> from PyQt4 import QtCore
>
> rather than
>
> from PyQt4.QtCore import *
>
> Just wondering, I never understood the mechanics of import...
>
> q.
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070323/4fa67873/attachment.html


More information about the PyQt mailing list