by Luis Artola
Presents techniques and patterns for creating custom PyQt widgets easily. Focus is the separation of layout and logic to produce code that is easy to read and understand, and also inexpensive to maintain and evolve. Encourages and demonstrates the use of layout design applications, code generators and composition over inheritance. Based on PyQt4 but easily applicable to PySide as well.
Many developers favor the creation of graphical user interfaces by hand-coding the layout of the interface elements. Most often than not, the resulting code is a highly cohesive mix of user interface and business logic that is not easy to maintain. Likewise, the development of custom widgets is often approached by subclassing top-level classes and overriding paint and event-handling methods. While this is the only alterantive for certain types of custom widgets, there is a big percentage that could be more easily created by composition of smaller widgets assembled together to work in as a unit.
This tutorial aims to share the following with the audience:
All material is based on Python and PyQt4. Audience is expected to have working knowledge of PyQt. Or, at least proficiency developing application in Qt and C++.
This tutorial is based on PyQt4 but concepts and techniques can be easily transferrable to PySide. Attendees require access to a computer with the following:
An easy way to check whether the Python plugin is available or not is to select from QtDesigner's main menu: Help > About Plugins > Loaded Plugins, should show libpythonplugin.so. This is normally installed automatically by the Qt installer.
7th–15th March 2012