Make a quick and easy user interface with Python !

Hi everyone !

Ilove programming, especially programming in Python. For those who do'nt know, Python is the most popular programming language both for web ans analytics. It's also very easy to write simple user interfaces with it.

GUIs, or Graphical User Interface(s) is the most common way to get the user to interact with your program. You see them everyday, unless you solely work on some obscure linux distro that has nothing but a CLI (Command Line Interface), or you live in the migthy 80s ( #msdos #28kInternet).

First off, I'm going to list every popular GUI toolkits available in Python 3.x.

1- Tk/Tcl

Tk/Tcl is available in Python under the tkinter package (Tkinter in python 2.x). It features a robust UI, with common features such as canvases, buttons, radiobuttons, text input, menu bars, notebooks, spinboxes etc.

Pros :
- Standard library, it is shipped with the interpreter
- Really easy to use and pythonic (compared to the others)
- Cross-platform

Cons :
- Really ugly. It looks like a throwback to windows 98. On GNU/Linux, it is not bad.
- Very limited options, and widgets. It won't quite work for really complex UIs

2- Qt
Qt is by far the most popular GUI toolkit out there, maybe not with python, but with C. Qt was written for C, and you can feel it in its syntax, even in Python. The library must be installed with pip to be used. (pip install pyqt5 pyqt5-tools).

Pros :

  • Comes with the Qt designer tool to sketch out GUIs, and cut down on repetitive code writing.
  • Cross-platform
  • Large choice of widgets

Cons :

  • Not pythonic. You'll be better off writing C++ code most of the time.
  • You must pay a license to sell commercial software built with Qt.

3- WxWidget
This library is one of the most popular ones, at least on windows, because yes, it's windows only which sucks. I haven't really tried it out, but most windows GUIs are written with this one.

Pros :

  • Large choice of widgets
  • quite beautiful

Cons :

  • Windows only

4- GTK+
GTK, or GNU Tool Kit is the library used in many GNU licensed softwares, such as GIMP, which is the piece of software this toolkit was written for. Install pyGTK to use it in python.

Pros :

  • Cross-platform
  • Some unique widgets
  • Under a very permissive license and open-source

Cons :

  • It's a unique look.

5- Other GUI toolkits
Python comes with many other great libraries such as remi, which builds a GUI you can view in a web browser, quite handy for remote controlled operations (on a raspberry pi for instance). Flask and django, although not GUIs per se may be used like so. pygame (which is a python wrapper over C's SDL) is quite useful for 2D games.

6- Confusion between UX and UI

As a developper, you'll be more focused on the UX (User eXperience) part of your GUI, which means the layout in your software. The UI part is handled by a designer, it's the decoration of your GUI, to make is look pretty.

In short :
UX > Usability
UI > Visibility

7- Tips about UX design

Get a whiteboard. It makes it easier. Think in advance which features you want your program to have. Think about which widgets are appropriate for which feature. Choose a toolkit based on :

  1. the widgets it contains. If you need a particular widget in a specific toolkit, choose that one.
  2. Licensing of the toolkit. If you can avoid paying a fee to use it in a commercial software, you may want to pick this one.
  3. Cross-platform availability. If you need a cross-platform piece of software, don't choose wxwidget

Draw your UI on your whiteboard, think how the user will feel when in front of the software. Every main feature should be in plain sight, and not hidden in some recluse menu. Some widgets need appropriate space to be usable. You don't want a 50 px² canvas to draw in, right ?

Let me know what you think of this rundown of python GUI toolkits, and if I missed anything!
Cheers !

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center