/* jquery */ /* jquery accordion style*/ /* jquery init */

16 April 2013

Learn Python - GUI Windows

From a user's perspective GUI applications tend to look very different from one another. For example, on the Raspberry Pi's desktop the Geany application doesn't seem to have much in common with the File Manager utility. However, this isn't the case.

GUI apps are assembled from a collection of windows. All these windows are arranged in a hierarchy. Most of us recognise the typical application window frame, with its bar containing the app name and an array of window management buttons to iconise, maximise and close the window.

Inside this main frame there's a top-level window containing an assortment of GUI elements, generally referred to as widgets. Buttons, labels, text boxes, images, scrollbars, selection boxes and sliders are all types of widget. However, did you realise that all these widgets are themselves little windows. In fact, each widget may itself contain other widgets.

Every widget has its own specific list of properties, such as location, size and colour. Very importantly, a widget is aware of certain kinds of events within its window area, such as a key press or a mouse click. I'll talk more about GUI events in a future post.

If all this sounds a little complex, don't worry, there's good news in the form of a Python 3 module called tkinter, (or Tkinter for Python 2.7). This module has a collection of GUI-specific functions to simplify GUI coding. So let's get started.

A post from my Learn Python on the Raspberry Pi tutorial.