PyQt 4.4 on Mac Os X with Qt 4.4
By AkH, 5 months, 2 weeks ago, modified June 5, 2008
Qt is a multiplateform GUI framework written in C++, but it has bindings for several language including Python.
Let's try it on Mac os X:
Download and install
First download a tool called sip: sip-4.7.6.tar.gz Qt 4 itself: qt-mac-opensource-4.4.0.dmg and PyQt-mac-gpl-4.4.2.tar.gz
As you can see trolltech is providing binaries for Mac, but riverbanks (who developp the Python bindings) only provide sources.
There are some docs for PyQt, the PyQt Classes reference and the PyQt and PyKDE wiki but the main documentation is the C++ one from Trolltech
Install the Qt package it will install components in:
- Qt Designer, Qt Linguist: /Developer/Applications/Qt
- Qt Documentation: /Developer/Documentation/Qt
- Qt Examples: /Developer/Examples/Qt
- Qt Plugins: /Developer/Applications/Plugins
- Qt Frameworks: /Library/Frameworks
- Qt Libraries: /usr/lib
- qmake, moc, uic, etc.: /Developer/Tools (symlink to /usr/bin)
Compiling sip
tar zxvf sip-4.7.6.tar.gz cd sip-4.7.6 python configure.py make sudo make install
Compiling PyQt
tar zxvf PyQt-mac-gpl-4.4.2.tar.gz cd PyQt-mac-gpl-4.4.2/ python configure.py make -j 2
sudo make install
Testing
In the PyQt compilation directory you still have an example directory just try:
python examples/widgets/analogclock.py

Displaying is really fast and responsive, many tools are provided like a GUI designer which can be translated to python, the API is really nice and well integrated on all plateforms, but ...
The downsides
- Qt is GPL it means all your code needs to be published if you plan to distribute your application, which is good cause the framework will live with the community, if you want a commercial solution Qt has a dual license, you can pay for that but PyQt also have a dual paying license, which make the global solution really expansive.


Comments