Signup/Sign In

Python Tkinter Widgets

In this tutorial, we will cover an overview of Tkinter widgets in Python. Tkinter widgets are the functional units on any Tkinter-based GUI application.

  • When you use the Tkinter module in Python, the first step is to create a Window object.

  • Once you have the window object, you can start adding the Tkinter widgets to the window.

  • There are different readymade Tkinter widgets available that can be used directly for creating user interfaces.

Tkinter Widgets

There are various controls, such as buttons, labels, scrollbars, radio buttons, and text boxes used in a GUI application.

These little components or controls of the Graphical User Interface (GUI) are known as widgets in Tkinter.

Python Tkintor Widgets

These are 19 widgets available in the Python Tkinter module. Below we have all the widgets listed with a basic description:

Name of Widget Description
Button If you want to add a button in your application then the Button widget will be used. A button is clickable and the user can click the button widget to perform any action.
Canvas To draw a complex layout and pictures (like graphics, text, etc.) the Canvas Widget can be used.
CheckButton If you want to display a number of options as checkboxes then the Checkbutton widget can be used. It allows you to select multiple options at a time.
Entry To display a single-line text field that accepts values from the user Entry widget can be used.
Frame In order to group and organize other widgets, the Frame widget can be used. Basically, it acts as a container that holds other widgets.
Label To Provide a single-line caption to another widget Label widget can be used. It can contain images too.
Listbox To provide a user with a list of options the Listbox widget can be used.
Menu To provide commands to the user Menu widget can be used. Basically, these commands are inside the Menu button. This widget mainly creates all kinds of Menus required in the application.
Menubutton The Menubutton widget is used to display the menu items to the user.
Message The Message widget mainly displays a message box to the user. Basically, it is a multi-line text which is non-editable.
Radiobutton If you want the number of options to be displayed as radio buttons then the Radiobutton widget can be used. You can select one at a time.
Scale Scale widget is mainly a graphical slider that allows you to select values from the scale.
Scrollbar To scroll the window up and down the Scrollbar widget in Python can be used.
Text The Text widget mainly provides a multi-line text field to the user where users enter or edit the text and it is different from Entry.
Toplevel The Toplevel widget is mainly used to provide us with a separate window container
SpinBox The SpinBox acts as an entry to the "Entry widget" in which value can be input just by selecting a fixed value of numbers.
PanedWindow The PanedWindow is also a container widget that is mainly used to handle different panes. Panes arranged inside it can either be horizontal or vertical
LabelFrame The LabelFrame widget is also a container widget used to mainly handle complex widgets.
MessageBox The MessageBox widget is mainly used to display messages in desktop applications.

Using all the above-mentioned Widgets, we can create amazing GUI applications.

Let's see a simple example where you will see some of these Tkinter widgets in action:

import tkinter as tk

root = tk.Tk()
root.title("Tkinter World")

label = tk.Label(root, text="Hello, Studytonight!")

entry = tk.Entry(root)

button = tk.Button(root, text="Click Me!")


Tkinter widget example


So in this tutorial, we got a basic introduction to Trinket Widgets. In our upcoming tutorial pages, we will cover each widget in detail with their respective code examples.

About the author:
I like writing content about C/C++, DBMS, Java, Docker, general How-tos, Linux, PHP, Java, Go lang, Cloud, and Web development. I have 10 years of diverse experience in software development. Founder @ Studytonight