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.

Related course:
PyQt Desktop Apps with Python

GUI toolkits

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.

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


5 thoughts on “Introduction to GUI

  1. Aliasgar gadli
    - May 28, 2017

    sir, can you explain me more about self keyword in detail… i m still a little bit confused

    1. Frank
      - May 29, 2017

      If you create an object from a class, it’s variables need to be set. The self keyword refers to the properties of the class. See also: https://pythonspot.com/python-class/

  2. 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

  3. 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.

Leave a Reply

Login disabled