Introduction to GUI

To create a graphical interface (GUI) in Python you need to make use of a library or module.  There are at least three widely used modules for creating GUIs with Python:

While you can create a graphical user interface (GUI) with any of these modules, they do not have the same features.

Tk provides basic widgets such as a button, menu, text and label. It is very limited compared to QT4 and WxPython but it is also the oldest module.  It runs on most versions of Mac OS, Linux and Windows.

TkMessage box
a messagebox in Tk. GUIs made in Tk do not have a native look.

QT4 and QT5 are developed by the Qt company.  Graphical applications made with QT4 or QT5 run on Windows, Linux/X11 and Mac OS X.  It has tons of widgets including tabs, buttons, item views, table views, progressbars, input fields, calendar views and many more. Compared to Tk it has a lot more widgets available.

Graphical application using PyQt5

WxPython is a module that creates a native GUI look regardless of the operating system used. On Windows it will look as windows application while on Mac OS it will look as a Mac application. This can be a clear advantage compared to QT4 or Tk, depending on your purpose. WxWidgets has many widgets available such as buttons, menu, text but also more advanced widgets as a htmlview or tree control.

A window created with wxPython. wxPython has native appearance on all operating systems.

3 thoughts on “Introduction to GUI

  1. pyraph - June 1, 2016

    ive been using cute (the original ide) before start learning python and it was as an alternative to code multiplataform, its far more easy for a freelancer dev to work with it than xamarin
    i think its important to state this when talking about cute
    it has its own libraries so basically you can reuse almost all the code you write
    and its not heavy so even a low-budget pc can manage it without problems

  2. Yusuf - June 11, 2015

    Am soo much enjoying and learning a lot from this blog. Hopefully in future you want to add these GUI libraries to your list?
    1) Kivy
    2) PyGTK
    3) PyGUI
    4) libavg

    Thanks for the good blog.

    1. Frank - June 11, 2015

      Thanks! I’ll create tutorials series for other GUI libraries later on.