Introduction to PyQt

Event-driven programming changes how programs function. Instead of following a list of instructions in the order defined by the programmer, instructions are executed based on events that are performed by the program user.

An event could be:

  • The clicking of a button
  • The dragging and dropping of an item
  • The selection of a command from a menu

Event-driven programming requires a graphical user interface. Therefore we are going to investigate this programming paradigm using the PyQt framework.


PyQt is the Python implementation of Qt, which is a cross-platform application and user interface framework. This means that the same code is used to generate the user interface on Windows, Mac OS X and Linux.

PyQt on Windows

PyQt on Mac OS X

Qt is incredibly sophisticated and capable and it will take you a long time to become familiar with its available operations. Therefore, you will need to keep the PyQt class reference under your pillow.


PyQt requires that you have a good understanding of object-oriented programming as the framework uses this paradigm through-out. If you are not comfortable with OOP, please spend more time developing the exercises from our OOP section before attempting this section.

This tutorial

This tutorial is designed to introduce you to some of the main concepts that underpin PyQt and also to familiarise you with the types of components, called widgets in PyQt, that your students are likely to need whilst developing projects for A-Level.

Through this series of tutorials you will take the crop, animal and field classes that you created during the object-oriented tutorials and develop them into graphical, event-driven programs.