PyQt4 on Windows ?

Gerhard Häring gh at ghaering.de
Tue Jan 20 22:28:00 CET 2009


Linuxguy123 wrote:
> What does it take to get a PyQt4 application running on a Windows
> machine ?

To run, installing Python + PyQt4 ;-)

To create a binary wrapper, I use py2exe (I also tried cx_Freeze, both 
work the same). There's a gotcha with PyQt4 - snippet follows:

setup(
     options = {"py2exe": {"compressed": 1,
                           "optimize": 2,
                           "includes": ["sip"],
                           "excludes": []}},
     service = [],
     com_server = [],
     console = [],
     windows = [modeler],
     )

You need to include the "sip" module manually, it's not automatically 
discovered.

To create an installer, I use NSIS.

> I'm sorry if this is a redundant question, but I've searched this and I
> am not finding a comprehensive answer.
> 
> If anyone is running a PyQt4 application on a Windows (XP or Vista)
> machine, I'd love to know how it works for you 

It works fine in a test setup. I didn't pursue this any further at the 
moment, because for the project in question we decided to deploy on 
MacOS X first and delay the Windows version.

> and how extensive the application is and how much of the Qt library it uses.

The application is currently 1200 LOC, 200 of which are autogenerated 
from Qt designer files. The final application will probably be about 
three times as large.

It's a modeler application and I most of the code is thus centered 
around QGraphicsScene and two custom QGraphicsItems - one for nodes, one 
for edges. It's been a real pleasure that I get most functionality for 
the modeling app for free with (Py)Qt.

-- Gerhard



More information about the Python-list mailing list