Creating a basic PyQt application

In this first series of tasks we are going to take the crop classes created during the object-oriented section of the course and develop a graphical user interface for them.

Before we start thinking about the interface for our program we must first set-up the basic structure of our application.

Creating a basic PyQt application

A PyQt application contains three main elements:

  1. Import statements to access the required functionality from the PyQt framework or Python
  2. A main window
  3. A main program which sets up the basic structure of the application

The video below demonstrates how to construct the basic application structure.


Task 1

Use the above video to help you create the application structure for the crop simulation.


Designing the interface

Before you start programming a graphical user interface you should design it first. This could be on paper or in a drawing/diagram package. You must consider the conventions you would expect to see in a graphical application on whatever the target platform is.

The design for our crop simulation program could be:

Crop simulation GUI showing flow of control

Once we have the basic design of our interface we need to consider how we will actually construct it using PyQt.