Tkinter Module in Python – Short Notes (10 Marks)
1. Introduction
Tkinter is Python’s standard GUI (Graphical User Interface) library. It provides tools to create
windows, buttons, labels, and text boxes. Built on top of Tcl/Tk toolkit, it comes pre-installed with
Python.
2. Main Features
• Easy to use and learn
• Platform independent
• Provides standard widgets (Label, Button, Entry, etc.)
• Supports event-driven programming
• Includes geometry managers (pack, grid, place)
3. Basic Structure of a Tkinter Program
import tkinter as tk
root = [Link]()
[Link]("My Window")
[Link]("300x200")
label = [Link](root, text="Hello Tkinter!")
[Link]()
[Link]()
4. Common Widgets
Label – Displays text or image
Button – Executes a function when clicked
Entry – Single-line input field
Text – Multi-line text area
Frame – Container for grouping widgets
Checkbutton, Radiobutton – Option selection
Listbox – Displays list of items
Menu – Creates menu bar
5. Geometry Managers
pack() – Arranges widgets vertically/horizontally
grid() – Arranges widgets in table (rows & columns)
place() – Uses fixed x, y coordinates
6. Event Handling
def hello():
print("Hello!")
btn = [Link](root, text="Click", command=hello)
[Link]()
7. Message Boxes and Dialogs
from tkinter import messagebox
[Link]("Title", "Message displayed here")
8. Advantages
• Simple and built-in
• Portable across platforms
• Ideal for small and medium applications
9. Limitations
• Not suitable for modern, complex GUIs
• Limited styling compared to PyQt or Kivy
10. Conclusion
Tkinter is a powerful, beginner-friendly module for building GUI applications in Python. Perfect for
educational and small projects.