Downloads (Python 3.x)
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
. API#2 is the default for PyQt4.6+ with Python 3.x
, and for PySide. The book uses API#1, but the differences are not
too big. Basically, most of the changes affect uses of QDataStream, QSettings, and QTextStream, and of course any use of QString methods (since in API#2, QString is gone, so we use str).
Versions of the examples for Python 3.0 and PyQt 4.5.1 using API#1 are available in the usual two formats, pyqtbook3.tar.gz
(718K suitable for any platform), and pyqtbook3.zip
line endings) [updated 2010-07-21 pyqtbook3.tar.tar.rar pyqtbook3.tar.tar.rar (718 K) 下载次数:84 ]
. The examples have also been ported to Python 3.1 and PyQt 4.7.3 using API#2: pyqtbook31.tar.gz
(723K suitable for any platform), and pyqtbook31.zip
(918K Windows line endings) [updated 2010-08-24 pyqtbook31.tar.tar.rar pyqtbook31.tar.tar.rar (1441 K) 下载次数:216 ]
. Note that both sets of Python 3 examples are straight conversions of the book's original examples and don't take any specific advantage of Python 3 or PyQt 4.5 (or later) features, except for using str.format() rather than the % operator. The API#2 versions don't always match up with the examples in the book (because the book uses API#1), but as already noted, the differences aren't huge and only affect a few specific classes.