Many of the scripting languages we teach include the ability to provide a GUI - a Graphic User Interface. I'll describe some particular GUIs later in this article, but let's start with ...
THE PRINCIPLES OF GUI PROGRAMMING
Writing a GUI based program is very different to writing a command line one - although you'll find if you've done a good design that you can use shared named blocks of code (subs, procs, functions or methods depending on the language) from both so you shouldn't have a major rework to write a GUI.
All the programming work of a GUI is done in the SETUP CODE.
You define a set of components (commonly known as widgets) which you want to appear
You describe how they're to be laid out using a geometry manager
You give a list of things that may happen (events) and define what's to
happen when an event occurs
And you then enter a main program loop that
Displays the GUI
Awaits events
Acts on the events
COMMONLY AVAILABLE GUIS
Tk - "Toolkit". Originally written by John Ousterhout to go with Tcl, Tcl/Tk is now a major use of Tcl - the Tool Control Language. It's also available in Python (Tkinter) and in Perl (Perl/Tk), though not as widely used there as it is with Tcl
Links
- Tcl/Tk
information and
training
- Tkinter
information and
training
- Perl/Tk
information and
training
wx - as in wxPython. A more recent windowing system originating from Python's support of the Windows Graphics look and feel. Now gaining great popularity.
Link
- wxPython
information and
training
Qt - Qt is a very powerful GUI library written in C++ and originally intended as a GUI for that language; it's available and well supported by Python.
Link
- PyQt
information and
training
AWT and Swing - The AWT (Abstract Windowing Toolkit) is Java's low level GUI. More complex components which allow realistic code to be written within sorter pieces of code may be found in Swing.
PHP isn't often used for stand alone applications, but you
can
use it through a GUI with GTK.
All of the GUIs mentioned are available / can run on Windows systems, on Mac OS X systems, and on Linux and Unix systems running the X Windows system; in the majority of cases, they'll use the graphics and the look and feel of those systems.
If you're writing a web application, you're likely to design the look and feel of your page (your GUI) using HTML and then use a system such as CGI (programmed in Perl of Python) or PHP in order to provide the equivalent of event handling.
Links
- Perl and Perl on the Web training
- Python (including web use) training
- PHP training
See also 2 day course - the Tk GUI
Perl/Tk [3009] Expect in Perl - a short explanation and a practical example - (2010-10-22)
[1340] Tk locks up - 100% c.p.u. on a simple program (Tcl, Perl, Python) - (2007-09-09)
[1310] Callbacks - a more complex code sandwich - (2007-08-19)
[738] (Perl) Callbacks - what are they? - (2006-05-30)
[599] Perl/Tk real time display - (2006-02-10)
[596] The magic of -textvariable - (2006-02-08)
[595] Add a friendly front end with Tk - (2006-02-08)
Additional PHP Material [3210] Catchable fatal error in PHP ... How to catch, and alternative solutions such as JSON - (2011-03-22)
[3118] Arrays of arrays - or 2D arrays. How to program tables. - (2011-01-02)
[2684] Exception handling in PHP - (2010-03-18)
[2215] If nothing, make it nothing. - (2009-06-02)
[2073] Extra PHP Examples - (2009-03-09)
[1623] PHP Techniques - a workshop - (2008-04-26)
[1519] Flipping images on your web page - (2008-01-26)
[1505] Script to present commonly used images - PHP - (2008-01-13)
[1485] Copyright and theft of images, bandwidth and members. - (2007-12-26)
[1451] More PHP sample and demonstration programs - (2007-12-01)
[1391] Ordnance Survey Grid Reference to Latitude / Longitude - (2007-10-14)
[1390] Converting from postal address to latitude / longitude - (2007-10-13)
[1389] Controlling and labelling Google maps via PHP - (2007-10-13)
[1270] PHP Standalone - keyboard to screen - (2007-07-18)
[1194] Drawing hands on a clock face - PHP - (2007-05-19)
[1104] Drawing dynamic graphs in PHP - (2007-03-09)
[1053] Sorting people by name in PHP - (2007-01-26)
[1020] Parallel processing in PHP - (2007-01-03)
[1010] Dates, times, clickable diarys in PHP - (2006-12-28)
[937] Display an image from a MySQL database in a web page via PHP - (2006-11-22)
[917] Syntax checking in PHP - (2006-11-07)
[839] Reporting on the 10 largest files or 10 top scores - (2006-08-20)
[822] PHP - a team member leaves - (2006-08-04)
[806] Check your user is human. Have him retype a word in a graphic - (2006-07-17)
[789] Hot answers in PHP - (2006-07-02)
[687] Presentation, Business and Persistence layers in Perl and PHP - (2006-04-17)
[665] PHP Image viewing application - (2006-04-01)
[603] PHP - setting sort order with an associative array - (2006-02-13)
[563] Merging pictures using PHP and GD - (2006-01-13)
[493] Running a Perl script within a PHP page - (2005-11-12)
[483] Double Dollars in PHP - (2005-11-02)
[468] Stand alone PHP programs - (2005-10-18)
[372] Time calculation in PHP - (2005-07-08)
[337] the array returned by preg_match_all - (2005-06-06)
[322] More maps - (2005-05-23)
[320] Ordnance Survey - using a 'Get a map' - (2005-05-22)
[239] What and why for the epoch - (2005-03-08)
[54] PHP and natural sorting - (2004-09-19)
Python and the Qt GUI [2746] Model - View - Controller demo, Sqlite - Python 3 - Qt4 - (2010-04-29)
[2744] PyQt (Python and Qt) and wxPython - GUI comparison - (2010-04-28)
[1036] Python Qt, wX, TkInter, and Jython - training?? - (2007-01-16)
wxPython [3139] Steering our Python courses towards wxPython, SQLite and Django - (2011-01-19)
[3092] wxPython geometry - BoxSizer example - (2010-12-17)
[3086] Sizers (geometry control) in a wxPython GUI - a first example - (2010-12-15)
[3081] wxPython - simple example to add GUI to a server log file analysis - (2010-12-08)
[2887] Snow Leopard and Python (that is OS X 10.6 and wxPython) - (2010-07-26)
[2744] PyQt (Python and Qt) and wxPython - GUI comparison - (2010-04-28)
[2013] wxPython - Introduction and sample - (2009-01-29)
[903] Pieces of Python - (2006-10-23)
Tcl/Tk - Introduction to Tk [2040] Error: Cant read xxxxx: no such variable (in Tcl Tk) - (2009-02-14)
[595] Add a friendly front end with Tk - (2006-02-08)
Java - Abstract Windowing Toolkit [3049] Computer Graphics is fun - even if Java Applets are Old Hat - (2010-11-13)
[2654] Java - from applets to servlets. JSPs and more - (2010-02-27)
[2649] Length, size or capacity in Java? - (2010-02-24)
[2245] Client side (Applet) and Server side (Servlet) Graphics in Java - (2009-06-17)
[1325] Java - Client side applet applications as well as server side - (2007-08-29)
Ruby GUIs, XML, SQL Database Connectivity [2714] A simple example - XML from a Ruby program - (2010-04-10)
[1890] MySQL database from Ruby - an example - (2008-11-16)
Extending Graphics in Java [1326] GUI design - Sketch it out first! (Java / Swing example) - (2007-08-30)
[1325] Java - Client side applet applications as well as server side - (2007-08-29)
Object Orientation and General technical topics - GUI principles [3081] wxPython - simple example to add GUI to a server log file analysis - (2010-12-08)
[2746] Model - View - Controller demo, Sqlite - Python 3 - Qt4 - (2010-04-29)
resource index - Deployment
Solutions centre home page
You'll find shorter technical items at
The Horse's Mouth and
delegate's questions answered at
the
Opentalk forum.
At Well House Consultants, we provide
training courses on
subjects such as Ruby, Lua, Perl, Python, Linux, C, C++,
Tcl/Tk, Tomcat, PHP and MySQL. We're asked (and answer)
many questions, and answers to those which are of general
interest are published in this area of our site.