Skip to content


Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Annotated PySide port of code from Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008). The book's web site is at:

The programs should run without mishap in your favorite Python environment, as long as you have PySide installed. It has thus far been tested on Python 2.7 in Windows 7. Unless otherwise noted, if the original name of Summerfield's script was name.pyw, the name of the adapted PySide script is

Annotations include comments in code, but each chapter also contains and files (the latter contains curated excerpts from PySide documentation and links from other relevant resources). When possible, we link to PySide documentation, but sometimes we have to go with Qt or PyQt when it is better.

Thanks to Mark Summerfield for encouragement, suggestions for improvement in innumerable places.

Table of contents

Chapter 4: Introduction to GUI Programming

Chapter 5: Dialogs

Chapter 6: Main Windows

Chapter 7: Using Qt Designer

Chapter 8: Data Handling and Custom File Formats

Chapter 9: Layouts and Multiple Documents

Chapter 10: Events, the Clipboard, and Drag and Drop

Chapter 11: Custom Widgets

Chapter 12: Item-Based Graphics

Chapter 13: Rich Text and Printing

Chapter 14: Model/View Programming

Chapter 15: Databases

Chapter 16: Advanced Model/View Programming

Chapter 17: Online Help and Internationalization

Chapter 18: Networking

Chapter 19: Multithreading

Some of the guidelines followed

  1. Follow Summerfield's recommendations for converting to Pyside, unless that would conflict with the remaining guidelines.

  2. Change old-style to new-style signals and slots.

  3. Replace from PyQt4.QtCore import *-type imports with from PySide import QtGui-type imports.

  4. Replace Qt.escape(), which is not used in PySide, with xml.sax.saxutils.escape() (see ).

  5. When opening files with codecs module, change the mode from "wt" to "w".

  6. Replace QtGui.QWorkspace (deprecated) with QtGui.QMdiArea. This entails a great deal of other relatively minor changes (see Chapter 9 texteditor code).

  7. For drawpolygon to work (Chapter 11) change list of numbers to list of QPoints. For instance, change: drawPolygon(QtGui.QPolygon([x1, y1, x2, y2])) to: drawPolygon(QtGui.QPolygon([QtCore.QPoint(x1, y1), QtCore.QPoint(x2,y2)]))

  8. Replace deprecated QMatrix and .matrix() with 'QTransform' and '.transform()` (Chapter 12).

  9. Replace the single line:


With the two lines:

    selectionModel = self.assetView.selectionModel()

This seems to be due to a bug in PySide (Chapter 15).

  1. Get sqlite to work by adding:

    site_pack_path = site.getsitepackages()[1] 

Before QtSql.QSqlDatabase.adDatabase("QSQLITE"). Be sure to import site. Not sure how platform-dependent this problem is. (Chapter 15)

  1. Replace obsolete Qt.TextColorRole with Qt.ForegroundRole.

  2. Replace .toPyDateTime() with .toPython()

  3. For Chapter 17, to get the *_fr.html pages to show up in the help pages, add:


Where 'locale' is the value entered by the user at the command line. Note this may not be required on all systems. I needed it in Python 2.7.6, Qt 4.8.4, PySide 1.2.1 on Windows 7.

  1. Replace isAlive(qObj) function, which uses sip, with:

    from Shiboken import shiboken
    def isAlive(qObj):
        return shiboken.isValid(qObj)

If you get the error that shiboken is not installed, in Windows command line:

pip install --use-wheel -U shiboken

Not sure what to do in Linux/Mac.

  1. At least in the first few chapters, we replace 'super' with explicit base class initialization, just to try it both ways (see


PySideSummer is under the GPL license (


PySide port of Summerfield's book 'Rapid GUI Programming with Python and Qt.'






No releases published


No packages published