free stats

Introduction to Tkinter

Last Update : 28 Aug, 2022 Python, Programming, GUI

In this tutorial, You will learn the basic introduction of Python Tkinter, Tkinter widgets, and the fundamental structure of the Tkinter program.

Tkinter is the most widely and commonly used Python library for developing graphical user interfaces. You do not need to worry about the installation of the Tkinter module separately on your PC. Because Tkinter comes with the python installation as a default module. Also, Tkinter is the Python interface to Tk, which is the GUI toolkit for Tcl/Tk. 

Tcl is a scripting language, which is used for prototyping, testing, and GUI development. 

Tk is a cross-platform, open-source widget toolkit that is used to build GUI programs using many different programming languages.

Not only the Tkinter but there are also some other Libraries available for creating our own GUI applications using python such as Kivy, PyQT, wxPython, etc.

Tkinter is a good choice for developing GUI programs using Python because of the following reasons.

  • Layered design.
  • Easy to learn.
  • Pre-installed with the standard Python library.
  • Run on all operating systems including Windows, macOS, and Linux.

 

What is the Tkinter Widgets?

Tkinter widgets are the element of GUI applications. It provides various controls such as Labels, Buttons,  MenuBars, RadioButtons, ComboBoxes, CheckBoxes, and many more to users who are interacted with the applications.

Following are the basic widgets available in Tkinter.

Frame -: This widget is used as a container for holding and organizing the widgets.

Button -: This widget is used as a way for the user to interact with the user interface.

Entry -: This widget is used to take input from the user through the user interface.

Check Button -: This widget presents to the user a set of predefined options.

Radio Button -: This widget presents the user to choose only one of a predefined set of mutually exclusive options.

Label -: This widget is used to display a simple text line or an image.

Menu -: This widget is used to create all kinds of menus used by an application.

ComboBox -: This widget contains a down arrow to select from a list of options.

Canvas -: This widget is used to draw graphs, images, and other layouts like texts.

Scale -: This widget is used to implement a graphical slider to the User interface. Also, the User has the option of picking through a range of values.

Scrollbar -: This widget allows users to scroll in a Tkinter window or enable certain widgets by scrolling.

 

Fundamental Structure of Tkinter Program

The undermentioned steps show the fundamental structure of the Tkinter program.

Step 01 : Import Tkinter modules.

Step 02 : Create the main loop of the GUI app

Step 03 : Adding widgets to the app.

Step 04 : Enter the main event loop.

 

You found this tutorial / article valuable? Need to show your appreciation? Here are some options:

01. Spread the word! Use following buttons to share this tutorial / article link on your favorite social media sites.

02. Follow us on Twitter, GitHub ,and Facebook.