Sessions at PyCon US 2012 about Python and Qt

Your current filters are…

Clear

Thursday 8th March 2012

  • Developing custom PyQt widgets and graphical interfaces efficiently.

    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:

    • Make a case for the benefits of using supporting tools for designing the layout portion of graphical user interfaces. In particular, the use of QtDesigner and code generators.
    • Present a pattern and project structure for creating PyQt widgets that can also be used inside QtDesigner.
    • Efficient use of composition over inheritance for assembling elaborate custom widgets more easily.

    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:

    • Qt 4.5.2 or later.
    • PyQt 4.5.4 or later.
    • sip 4.8.2 or later.
    • QtDesigner.
    • Python plugin for QtDesigner.
    • Python 2.5.x, 2.6.x or 2.7.x.

    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.

    At 1:20pm to 4:40pm, Thursday 8th March

    In H1, Santa Clara Convention Center