15.1 Graphical User Interfaces
A graphical user interface (GUI) allows a user to interact with a computer program
using a pointing device that manipulates small pictures on a computer screen. The small pictures are called
icons
or widgets
. In PySimpleGUI, they are called
elements
. Various types of pointing devices can be used, such as a mouse, a stylus pen, or a
human finger on a touch screen.
We refer to programs that use a graphical user interface as “GUI programs.” A GUI
program is very different from a program that uses a command line interface which
receives user input from typed characters on a keyboard. Typically, programs that use a command
line interface perform a series of tasks in a predetermined order and then terminate. However,
a GUI program creates the icons
and widgets
(elements
) that are
displayed to a user and then it simply waits for the user to interact with them. The order that tasks are
performed by the program is under the user's control – not the program's control! This means a GUI program
must keep track of the “state” of its processing and respond correctly to user commands that are given in any
order the user chooses. This style of programming is called “event driven programming.” In fact, by
definition, all GUI programs are event-driven programs.