Python GUI Programming using Tkinter
There are many Graphical User Interfaces (GUI) available. The GUI we will use here is called Tkinter, which is the standard graphical interface of Python.
This page provides the first introduction to Graphics Programming using Tkinter GUI.
Graphical User Interface (GUI) vs. Command Line Interface (CLI)
In the previous chapters, you have been writing programs that require you to enter text commands on the command line. This approach is called Command Line Interface (CLI).
As opposed to CLI, the Graphical User Interface (GUI) lets the user interact with the programs on the screen using a mouse, keyboard, or joystick. The Graphical User Interface (GUI) enables the programmer/user to change the flow of the program by clicking on a graphical object such as a button, drop-down menu, check boxes, and such.
The program that lets the user interact with graphical objects is called Graphical User Interface (GUI). Writing programs using GUI is called graphics programming or computer graphics.
Video games are one of the most important inventions of our age and are an example of the application of computer graphics and graphics programming.
Why Graphics Programming Is So Widely Used
Graphics programming is a highly effective way of communication between humans and computers since the human eye can capture and absorb the information displayed as a graph or an image much faster than in text or table form.
Furthermore, GUI gives the programmer or player of the game immediate visual feedback on their actions and thus results in capturing the interest of the young learner.
What is Tkinter
Python distribution includes a Graphical User Interface (GUI) based on Tk GUI originally developed by Sun Labs. Tk stands for Tool kit. The Python standard library includes the Tkinter module.
Tkinter is Python’s standard GUI (Graphical User Interface) package, which is the standard Python interface to the Tk GUI toolkit.
Tkinter stands for “Tk Interface”, which serves as an interface to the Tk toolkit. The Tkinter module contains all classes and functions needed to work with the Tk toolkit. Tkinter consists of several modules that we will discuss in the next sections.
More details of Tkinter are at this link below.
<a href=”https://docs.python.org/3/library/tkinter.html“>
Tkinter Widgets
Tkinter programming uses what are called Widgets. We will create User Interface (UI) using Tkinter ‘widgets’. The widgets are graphical components like check-boxes, buttons, pull-down menus, labels, etc. These widgets can support text or images. The widgets will enable you to create a very interesting user interface (UI) that a user can interact with to instruct the program to take a certain action.
Some examples of this UI are:
- Clicking the mouse button on the button widget to change the color of the button widget
- Hovering the mouse over the text to change the color
- Clicking on a check-box to do a selection out of many options
Copyright © 2019 – 2021 softwareprogramming4kids.com
All Rights Reserved