Published on (
 See this if you're having trouble printing code examples

Python News

GUI Development with Python and Qt


Last month, TrollTech announced a new license for a non-commercial edition of Qt for Windows. Qt is the C++ cross-platform GUI toolkit used by KDE on Unix systems. Previously, to compile and distribute Qt applications for Windows you had to pay for a developer's license. The new license opens up Qt for non-commercial use. As long as you are not selling your Qt applications or using them for your business, you no longer need to pay for a license. This free use license is not suitable for creating GPL Qt applications on Windows, but it is one less barrier to free development.

With the new license, Qt should be a more attractive cross-platform GUI toolkit for developers, including Python developers. With the Kompany's Python bindings for Qt, PyQt, you can easily program Qt applications without knowing any C++. Even if you know C++, Python can make your Qt programming easier. Conveniently, Open Docs just published a preview release of Boudewijn Rempt's Gui Programming with Qt and Python. While only half done, chapters 6-14 cover the basics of Qt programming using PyQt, including very clear coverage of slots. The unfinished first section will cover BlackAdder, the Kompany's IDE for Python/Qt development. BlackAdder combines Qt's user interface design tool, Designer, with Python's idle, a debugger and project management features. It's a sweet package, but BlackAdder is not required to start programming in Qt; all of these tools are available separately. Most of the examples Rempt gives are short and easy to grasp and can be developed using any development tool you are familiar with.

Near the end of the completed chapters, Rempt walks through the development of a more advanced Qt program. He starts out this section with a chapter on unit testing, a way of creating tests for your program as you program, and ensuring the behavior of your program does not change unexpectedly. If you are interested in using unit testing in your programming, this chapter alone might be worth a look at the book. There is nothing Qt specific in it, just information on using the unit test module. Later chapters integrate unit testing with the development of the advanced example.

Open Docs is interested in feedback on the book. If you have been holding off on Qt, here's your chance to both learn it and contribute to the development of this open book.

Stephen Figgins administrates Linux servers for Sunflower Broadband, a cable company.

Read more Python News columns.

Return to the PHP DevCenter.

Copyright © 2009 O'Reilly Media, Inc.