Book Image

Pyside GUI Application Development- Second Edition - Second Edition

By : Venkateshwaran Loganathan, Gopinath Jaganmohan
Book Image

Pyside GUI Application Development- Second Edition - Second Edition

By: Venkateshwaran Loganathan, Gopinath Jaganmohan

Overview of this book

Elegantly-built GUI applications are always a massive hit among users. PySide is an open source software project that provides Python bindings for the Qt cross-platform UI framework. Combining the power of Qt and Python, PySide provides easy access to the Qt framework for Python developers and also acts as an excellent rapid application development platform. This book will take you through everything you need to know to develop UI applications. You will learn about installing and building PySide in various major operating systems as well as the basics of GUI programming. The book will then move on to discuss event management, signals and slots, and the widgets and dialogs available with PySide. Database interaction and manipulation is also covered. By the end of this book, you will be able to program GUI applications efficiently and master how to develop your own applications and how to run them across platforms.
Table of Contents (13 chapters)

Building PySide

PySide is a collection of four interdependent packages, namely API Extractor, Generator Runner, Shiboken Generator, and Pyside Qt bindings. In order to build PySide, you have to download and install these packages in that order:

  • API Extractor: This is a set of libraries that is used by the binding generator to parse the header and type system files to create an internal representation of the API [].

  • Generator Runner: This is the program that controls the bindings generation process according to the rules given by the user through headers, type system files, and generator frontends. It is dependent on the API Extractor [].

  • Shiboken Generator: This is the plugin that creates the PySide bindings source files from Qt headers and auxiliary files (type systems, global.h, and glue files). It is dependent on Generator Runner and API Extractor [].

  • PySide Qt Bindings: This is a set of type system definitions and glue codes that allows generation of Python Qt binding modules using the PySide tool chain. It is dependent on Shiboken and Generator Runner [].

Always, make sure that you have downloaded and built these packages in this order because each of these packages is interdependent. The build steps for each of these are:

  1. Unzip the downloaded packages and change into the package directory:

    tar –xvf <package_name> 
    cd <package_directory>
  2. Create a build directory under the package directory and enter that directory:

    mkdir build && cd build
  3. Make the build using cmake:

    cmake .. && make
  4. On a successful make, build and install the package:

    sudo make install

    Please note that you require sudo permissions to install the packages.

  5. To update the runtime linker cache, issue the following command:

    sudo ldconfig

Once you complete these steps in this order for each of these packages, PySide should be successfully built on your system.

Mac OS X

Building PySide on a Mac system follows the same procedure as the Linux system except that Mac needs Xcode-Developer Tools to be installed as a prerequisite.


If you are installing the libraries in a nondefault system directory (other than /usr/local), you may have to update the DYLD_LIBRARY_PATH by typing the following command:

export DYLD_LIBRARY_PATH=~/my_dir/install/lib