Creating Python GUI App

I've been working with python for a while now and it didn't take me long to come across problems for which a graphical user interface was an important part of the solution.  I write quite a few mini-apps that are used for debugging and testing peripherals that attach to the PC, so a simple interface that displays images, buttons and other inputs was useful.

I looked around and found a couple of ways that you can write form-like GUIs in python:  Tkinter a wxGlade.

Tkinter

This comes built in to python installations, which means that you don't need to download anything else once you have Python.  You can start development straight away.  It also means that if you provide your code to other people, they won't need to download anything either.  This is in contrast to wxGlade, which requires a separate download.  The download isn't any hassle, but is something to bear in mind.

When it comes to actually writing the GUI in Tkinter I haven't yet found a graphical tool for doing that.  This means that you need to hand-write all the code for creating the form, populating it with buttons/text boxes and then arranging everything.  Documentation for how to do this is up to the usual open source standard - in other words there's lots of technical, difficult to understand documents and painfully few low-level tutorials and introductions.  Unfortunately I've not yet gained enough experience in Tkinter to provide my own tutorial on this.

Creating a GUI with Tkinter isn't necessarily particularly difficult, but it can be hard to figure out how where to being if you're new to it.  And for novice programmers I'd recommend wxGlade instead.

wxGlade

This requires a separate download, but has a fully-functioning GUI for development work.  This provides a way to populate an interface with tabs, menu bars, status bar, buttons etc.  It'll then create the source code to generate the interface in either Python of C++.  You can add your own code to the files it creates, and when wxGlade updates it'll leave your code alone.  It's easy to use and creates nice little applications.

On the down side, it's not very good at re-arranging the layout.  Once I've created a few buttons and check boxes, if I want to add something else or just move things around a bit then things can start going wrong.  It isn't very intuitive about generating the layout and tweaking it.  But once you've got things looking right, it makes things a doddle.  All the code for events tied to button presses, menu bars and such like is created for you.  And you can manually tweak the source code should you wish.

Links

Tkinter Introduction

Tkinter Information

wxGlade Download

wxGlade Tutorial

Another wxGlade Tutorial