Simple Qt GUI

There are multiple ways to design graphical user interfaces (GUIs) for python applications.

  • PyQt
  • TKinter
  • Kivy
  • wxPython
  • PySimpleGUI
  • PyForms
  • Wax

One of the challenges that I face when designing GUIs, is how hard it becomes to follow code when application code and GUI code are mixed together. Moreover, if I want to change how the GUI looks later in a project, or add new functionalities, it can be tough to adjust the code accordingly.

Note: It might not be a good idea to change a GUI in a project after you wrote a bunch of application code. Make sure that the GUI design pretty much complete before you write any application code, but sometimes changes might need to happen.

For the majority of the GUI interfaces listed above, this "mixture" is inevitable, but this article is going to show how we can use PyQt to separate the application code from the GUI code, in a way that allows the developer to accommodate changes in a GUI or adding new functionalities later in a project, keeping the code "clean" and separated.

Step 0 - Install Qt Creator

Step 1 - Create GUI using Qt Creator

Step 2 - Design the GUI

Step 3 - Integrate ui File with Python Code

Step 4 - Include the Application Code

Step 5 - Add a Component

References