Earlier this year I was writing a python GUI program using QT, and was struggling trying to get the layout right. My exposure to QT/PyQt has been sporadic and infrequent, which is one reason why I had problems learning it. Unfortunately, I could not wait until the end of 2007 for the book to be published, so I continued struggling through my problems.
When Prentice Hall told me that Rapid GUI Programming with Python and QT was ready for review, I jumped at the opportunity. The book is hard bound which is something of a treat, and not found often in books on programming. Most of the books given to the users group I belong to are soft covered, and I presume this is for cost reasons. It would be interesting to understand how and why publishers choose which books will be published in hardcover. The book is quite thick with 625 pages to its credit, and the paper is non-glossy making it easy to read without throwing an irritating reflection.
The author, Mark Summerfield is a seasoned veteran to python programming, and in particular QT. Mark worked for Trolltech, the Norwegian company from where QT originated. He also co-authored books on QT3 and QT4, which emphasized using QT from C++. This book covers many aspects of using QT through python, as well as very practical examples and exercises. So many programming books feature trivial examples which don’t really illustrate ´How would I use this in the real world?¡ I am also impressed by the fact that basic, intermediate and advanced topics are covered.
For those new to QT, is the result of tens of thousands of hours of work by a small group of many dedicated people. I almost hesitate to label QT as merely a cross-platform GUI framework, because that just isn’t a sufficient description. However in order to write a fair review, I won’t spend any further time describing it. The bindings which allow us to use QT from the Python realm are known as PyQt. This project is solely maintained by Phil Thompson. Not surprisingly, Phil wrote the Forward for this book. Without his dedication, Python users would not have the luxury of using QT as easily as they do now.
For the most part, I really like the structure, layout, and contents of the book. The main disappointment is with the first three chapters which take up 108 pages on an introduction to Python programming. A personal plea to all authors writing or contemplating writing a book which contains intermediate or advanced topics on Python:”please skip the Python introduction!” There are already many (almost too many) introductory Python books available, so leave it alone. Why waste the precious space in this book by glossing over a few concepts, when anyone who is seriously interested in learning Python will have one or more complete books on Python at their disposal?
QT, like all GUI frameworks is continuously undergoing changes. QT4 was almost entirely re-written from version 3, and there are significant differences between QT 4.1 and 4.3 as well. A few paragraphs touching on the differences between QT 4,1 and 4.3 would have been helpful in an early section of the book. There are markers by selected paragraphs which illustrate when that paragraph pertains to a specific version of QT 4.x.
My only other wish for this book would be that some block diagrams be included on Signals and Slots. The QT documentation contains these and they help to understand these critical concepts. The problem with the C++ documentation is if you’re not comfortable with that language, trying to extract and make the ´appropriate’ changes to make a Python application work, can be daunting.
There are chapters on advanced topics such as using QT Designer, Internationalization, Database-related topics, Model View Controller customization, threading, and graphics. A wide variety of topics to round out this book nicely.
The 3 appendices touch on some topics which really need to be discussed. The first and foremost being “Installing QT”. This has been a sore spot with many people, including myself. Installing QT, PyQT, and SIP (the 3rd and necessary component needed to use QT from Python) are a royal pain for first-time QT users, and I hope they will be consolidated into a single convenient installer one day. Appendix A covers installation on Windows, Linux and MAC OSX. Having only worked with PyQt on Windows, I will say finding concise documentation was equally frustrating when I had first tried using QT. I would have expected that the contents of Appendix A should have been in the very beginning of the book, before the first line of code appeared..
Appendix B is a brief pictorial description of a few of the QT widgets. Real working examples of many more widgets are found in the demo program which is created as QT is compiled.
Appendix C contains a class inheritance hierarchy of selected QT classes. I don’t think I’ve ever seen this even in the QT docs. What a great addition!
Overall Rating: 9 out of 10.
The bottom line: If you’re planning on using QT from Python, don’t hesitate to add this book to your collection. It will be a valuable addition to your Python bookshelf, and will make your journey into the world of QT easier.
Thanks to Trolltech, Phil Thompson, Mark Summerfield and many others for making QT/PyQt such fine products.