A Python program can have a real window, not just a terminal. There are four libraries worth knowing, and they differ in how heavy they are and how the apps look on each platform.

PyQt

PyQt runs on Windows, Mac and Linux. The current version is PyQt5. It gives you the usual desktop widgets, and it also has network sockets, database access and multimedia.

PyQT video player demonstration

Here is a small PyQt program.

A Glimpse at Tkinter

Tkinter is the oldest one and it comes with Python, so there is nothing to install. It has buttons, textboxes, list views and labels. That is enough for a small tool, but there are not many widgets beyond that.

Understanding WxPython

WxPython is built on the C++ library wxWidgets. It uses the native widgets of the platform, so the app looks native everywhere. Unlike PyQt it is not sold by a company.

The four options

  • Tkinter comes with Python, so there is nothing to install. The apps look plain and a bit old. Fine for a first window and for small tools.
  • PyQt and PySide are the same toolkit, one from Riverbank and one from Qt. They give the most widgets and look native on each platform. Both are free, PyQt is GPL and PySide is LGPL.
  • Kivy draws everything itself, so it looks the same everywhere. Good for touch screens.
  • wxPython is older, it uses the native widgets of the platform.

Start with Tkinter to learn the idea: create a window, add a widget, connect a button to a function. When you want a better looking app, move to PyQt, the code is different but the idea is the same.

The widgets always go in a layout, never at a fixed position. Then the window keeps looking right when someone resizes it.

Want more practice on this? Practise this on PyChallenge, there are short browser exercises you can run right after reading.