| Rapid GUI Programming with Python and
Qt The Definitive Guide to PyQt Programming by Mark Summerfield ISBN-10: 0132354187 – ISBN-13: 978-0132354189 |
|
|
This book teaches programmers how to write programs using PyQt 4,
the Python bindings for the Qt 4 application development framework.
PyQt 4 is probably the fastest and easiest route into GUI
programming and works on Windows, Mac OS X, and most operating
systems that use the X Window System, such as Linux and many
Unices. (Note that the book is also useful for PySide programmers since
apart from the imports and a few static functions, PySide has
the same API as PyQt 4's API#1. Be aware that from PyQt4.6,
PyQt now has two different APIs—but this only affects
Python 3 out of the box and doesn't affect Python 2 users
unless they want it to: see About PyQt's APIs.)
The book will be useful to people who program professionally as part of their job, whether as full-time software developers, or those from other disciplines, including scientists and engineers, who need to do some programming in support of their work. It is also suitable for students—the only prerequisite is basic knowledge of an object oriented programming language, for example, Java or C++, or of course Python itself. The book is ~550 pages (648 including the appendices and index), has a foreword by Phil Thompson creator of PyQt, and is published by Prentice Hall. It can also be bought from Amazon.com, Barnes & Noble, Amazon.co.uk, Amazon.de, Amazon.fr, Amazon.jp, and other online and local book stores. Only the printed editions are definitive—although available in electronic formats, ``ebooks'' are often retypeset, which can introduce errors. The InformIT website has a Sample Content page which provides an online (HTML) copy of Chapter 4, and downloadable (PDF) copies of Chapter 4, the Foreword, the Introduction, and the Index. The source code, including mkpyqt.py and Make PyQt is available in two formats, pyqtbook.tar.gz (717K suitable for any platform), and pyqtbook.zip (913K Windows line endings) [updated 2009-12-03]. (See the bottom of the page for versions of the examples for Python 2.6 and Python 3.) There is also an Errata [updated 2009-11-30]. A Chinese translation is in the works. Table of Contents—the chapters also have exercises and summaries
Part I is designed to quickly teach Python to non-Python programmers so that they can use the rest of the book. This part is also useful to Python programmers because it covers some of the non-GUI Qt classes, and some of the Python techniques that are often used in GUI programming, such as partial function application. Most of the text is in Parts II, III, and IV. The chapters in these parts cover similar ground to my C++/Qt books, but have been written entirely from scratch with different examples and written from a totally PyQt 4 perspective. Also, some topics are included that are not covered by my other books, for example, the rich text engine, and some more advanced model/view programming techniques. The book is based on Python 2.5, Qt 4.2, and PyQt 4.2, with notes regarding earlier and future versions where appropriate. All the examples have been tested on Windows, Mac OS X, and Linux with Python 2.5, Qt 4.2-4.6, and PyQt 4.2-4.6. The Python 2.6 versions of the examples have been tested on Linux with Python 2.6, Qt 4.4-4.6, and PyQt 4.4-4.6. Python learners might find Sandbox useful. It is a PyQt application for experimenting with Python and for editing Python code. It develops many of the ideas explored in the book, drawing particularly on chapters 5, 6, 8, 9, and 13. Another useful tool for any GUI programmer is Alt_Key. This program (available in both PyQt and C++/Qt), can be used to automatically generate keyboard accelerators. For more information on the tools the book teaches see the Python website, the Qt Software website (makers of Qt), and the Riverbank website (makers of PyQt 4). And for those interested in scientific and engineering programming the Python(x,y) Python distribution should be of interest. |
Reviews & Unsolicited Reader Comments
|
|
Although the examples work fine with both Python 2.5 and Python 2.6, I've created Python 2.6–specific versions that use a different import style from that used in the book and that take some advantage of Python 2.6's Python 3–like features. The code is available in two formats, pyqtbook26.tar.gz (721K suitable for any platform), and pyqtbook26.zip (926K Windows line endings) [updated 2010-01-13]. Mac users please note that PyQt does not seem to be buildable with Python 2.6 on Mac OS X, at least not for me and for some readers in the summer of 2009, so Mac users are recommended to use Python 2.5, or maybe try Python 3! Versions of the examples for Python 3/PyQt 4.5.1 are also available in the usual two formats, pyqtbook3.tar.gz (719K suitable for any platform), and pyqtbook3.zip (920K Windows line endings) [updated 2010-01-13]. Note that these examples are straight conversions of the book's original examples and don't take any specific advantage of Python 3 or PyQt 4.5 features. About PyQt's APIs—From PyQt4.6, PyQt has two APIs, API#1 (the original), and API#2 (new). API#2 is more Pythonic and eliminates QString and QVariant, and is a bit nicer to use. API#1 remains best for those using PyQt to prototype C++/Qt applications. API#1 is the default for PyQt4.x with Python 2.x, and for PyQt4.0-4.5 with Python 3.x, and is the API used by PySide. API#2 is the default for PyQt4.6+ with Python 3.x. The book, and all its examples use API#1, so they don't work with PyQt4.6+ with Python 3.x—but they do work with PyQt4.x with Python 2.x, and for PyQt4.0-4.5 with Python 3.x. Although I personally prefer API#2, I am not planning to port the examples to use it, since it would make the examples so far out of sync with the book as to be confusing. | |
| Like all my books and most of my other writings, this book was written using The Lout Typesetting System. | |
| Copyright © 2006-10 Qtrac Ltd. All Rights Reserved. | |