Tkinter - an easy to use Python Graphic User Interface - introductory examples
Archive - Originally posted on "The Horse's Mouth" - 2011-10-13 07:56:51 - Graham EllisTkinter (tkinter from Python 3.0 - note the different case) is a graphic user interface (GUI) that's included with the Python distribution. It's a lightweight wrapper around the Tk Toolkit - frequently used with Tcl too - and it provides a very quick and easy way to replace user-facing command line interfaces with interaction windows with buttons, labels, sliders, text entry boxes, etc.

Set up a root window:
root = Tkinter.Tk()
Add a couple of components into that window, and display them:
Tkinter.Label(text='Hello GUI World').pack()
Tkinter.Button(text='exit', command = sys.exit).pack()
And wait for the user to do something (alas, all we have provided for him in this simple example is an "exit" button!)
root.mainloop()

• Setting up widgets
• Arranging widgets in a geometry
• Acting when widgets are used (e.g. buttons pressed)
• providing feedback within the GUI's window
Our Python Courses overview the various GUIs available and include short intriductory demos such as the ones above. If you want to study any particuar GUI in more detail, let us know in advance (for a private course) or ask us to run an "extra day" for you after our public course. We have a great deal of material available on Tk, and plenty on Qt and wx too, but as only a small proportion of delegates uses each we can't justify their full and detailed coverage for everyone on a public course.