Tkinter in Python

In this tutorial, we will learn Tkinter in Python. Tkinter is a library which allows us to create Graphical User Interface. We can create desktop-based applications with the help of Tkinter. In this Tkinter tutorial series, we will learn various widgets in Tkinter along with Example programs.

Steps to use Tkinter in your Application:

  • Import Tkinter in your program
  • Create the main application window.
  • Add the widgets such as button, label in your main application window
  • Add actions to different widgets in your applications

Example Program of Tkinter in Python:

#importing tkinter lib
from tkinter import *  
#creating the main window.   
mainWindow = Tk()  
#event main loop  

Widgets in Tkinter:

Widget Description
Button This widget is used to add button in Python application.
Canvas This widget is used to make a canvas in Python application.
Check Button This widget is used to show options with checkboxes in python application.
Entry This widget is used to get a single line entry from the user.
Frame This widget is used for grouping of other Tkinter Widgets.
Label This widget is used to show caption with other widgets.
LabelFrame Tkinter LabelFrame acts as a container and used to create a border around child widgets.
ListBox This widget helps up to show list of items in application.
MenuButton This widget used to show the drop-down menu.
Menu This widget helps us to add a menu in the application.
Message Python Tkinter Message works same as Lable expect it can automatically wrap up text.
MessageBox Tkinter MessageBox widget is used to show the message box in the application.
PanedWindow PanedWindow is a widget which is used as a container. A PanedWindow can contain one or more child Panes.
RadioButton This widget is used to show multiple options to the user.
Scale Tkinter Scale widget is used to the graphical slider.
ScrollBar ScrollBar widget is used to make the content of other widgets scroll-able.
Text The Tkinter Text widget is used to show multi-line text in the application
TopLevel TopLevel is used to show top-level screen and which directly managed by the window manager.
Spinbox Spinbox is an entry widget which is used to ask the user to choose one from fixed values.
Spread the love
Scroll to Top