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  

Tkinter in Python Output:

Tkinter in Python

Widgets in Tkinter:

ButtonThis widget is used to add button in Python application.
CanvasThis widget is used to make a canvas in Python application.
Check ButtonThis widget is used to show options with checkboxes in python application.
EntryThis widget is used to get a single line entry from the user.
FrameThis widget is used for grouping of other Tkinter Widgets.
LabelThis widget is used to show caption with other widgets.
LabelFrameTkinter LabelFrame acts as a container and used to create a border around child widgets.
ListBoxThis widget helps up to show list of items in application.
MenuButtonThis widget used to show the drop-down menu.
MenuThis widget helps us to add a menu in the application.
MessagePython Tkinter Message works same as Lable expect it can automatically wrap up text.
MessageBoxTkinter MessageBox widget is used to show the message box in the application.
PanedWindowPanedWindow is a widget which is used as a container. A PanedWindow can contain one or more child Panes.
RadioButtonThis widget is used to show multiple options to the user.
ScaleTkinter Scale widget is used to the graphical slider.
ScrollBarScrollBar widget is used to make the content of other widgets scroll-able.
TextThe Tkinter Text widget is used to show multi-line text in the application
TopLevelTopLevel is used to show top-level screen and which directly managed by the window manager.
SpinboxSpinbox is an entry widget which is used to ask the user to choose one from fixed values.
Spread the love