www.pythonware.com products ::: library ::: search ::: daily Python-URL!
   

An Introduction to Tkinter

Next   

 

An Introduction to Tkinter

Fredrik Lundh

Copyright © 1999 by Fredrik Lundh

If you are looking to dive into Python desktop development, starting with Tkinter is easily the best move you can make. It is built right into Python, so you do not have to download anything extra to get started.

Think of Tkinter as the tool that finally gives your Python code a "face." Up until now, you have probably been running scripts in a boring black terminal window, but Tkinter lets you create actual windows with buttons you can click, text boxes you can type in, and menus you can navigate.

What can be done using python tkinter?

With Tkinter, you can build a surprising variety of desktop applications right in Python, from super simple scripts to more polished tools that feel like real software. At its core, it's great for creating windows with buttons, labels, text entries, menus, and dialogs—think quick utilities like a basic calculator, a to-do list app, or a file browser.

You can add interactive elements like dropdowns, checkboxes, sliders, and even a canvas for drawing shapes or simple graphics, making it perfect for things like data entry forms, configuration panels, or even basic games.

For more advanced stuff, Tkinter supports embedding images, handling mouse and keyboard events, creating multi-window interfaces, and integrating with other libraries (like matplotlib for charts or SQLite for databases), so people use it for everything from scientific tools and automation scripts with GUIs to custom editors or even modern-looking apps with themes from packages like ttkthemes.

Why Tkinter is great for students:

  • No Setup Required: Since it's part of the standard Python library, it just works.
  • Simple Logic: You learn how "Event-Driven Programming" works (basically, the code waits for the user to do something).
  • Instant Results: You can build a working "Hello World" window in just 4 or 5 lines of code.

Table of Contents
Preface
I. Introducing Tkinter
1. What's Tkinter?
2. Hello, Tkinter
Running the Example
Details
3. Hello, Again
Running the Example
Details
More on widget references
More on widget names
4. Tkinter Classes
Widget classes
Mixins
5. Widget Configuration
Configuration Interface
Backwards Compatibility
6. Widget Styling
Colors
Fonts
Text Formatting
Borders
Cursors
7. Events and Bindings
Events
8. Application Windows
Base Windows
Menus
Toolbars
Status Bars
9. Standard Dialogs
Message Boxes
Data Entry
10. Dialog Windows
Grid Layouts
Validating Data
II. Tkinter Reference
11. The BitmapImage Class
When to use the BitmapImage Class
Patterns
Methods
Options
12. The Button Widget
When to use the Button Widget
Patterns
Methods
Helpers
Options
13. The Canvas Widget
When to use the Canvas Widget
Concepts
Patterns
Methods
Options
14. The Canvas Arc Item
Methods
Options
15. The Canvas Bitmap Item
Bitmaps
Methods
Options
16. The Canvas Image Item
Methods
Options
17. The Canvas Line Item
Methods
Options
18. The Canvas Oval Item
Methods
Options
19. The Canvas Polygon Item
Methods
Options
20. The Canvas Rectangle Item
Methods
Options
21. The Canvas Text Item
Methods
Options
22. The Canvas Window Item
Methods
Options
23. The Checkbutton Widget
When to use the Checkbutton Widget
Patterns
Methods
Options
24. The DoubleVar Class
When to use the DoubleVar Class
Patterns
Methods
25. The Entry Widget
When to use the Entry Widget
Concepts
Patterns
Methods
Options
26. The Font Class
Patterns
Methods
Functions
Options
27. The Frame Widget
When to use the Frame Widget
Patterns
Methods
Options
28. The Grid Geometry Manager
When to use the Grid Manager
Patterns
Methods
Options
29. The IntVar Class
When to use the IntVar Class
Patterns
Methods
30. The Label Widget
When to use the Label Widget
Patterns
Methods
Options
31. The Listbox Widget
When to use the Listbox Widget
Patterns
Methods
Options
32. The Menu Widget
When to use the Menu Widget
Patterns
Methods
Options
33. The Menubutton Widget
When to use the Menubutton Widget
Patterns
Methods
Options
34. The Message Widget
When to use the Message Widget
Patterns
Methods
Options
35. The Pack Geometry Manager
When to use the Pack Manager
Patterns
Methods
Options
36. The PhotoImage Class
When to use the PhotoImage Class
Patterns
Methods
Options
37. The Place Geometry Manager
When to use the Place Manager
Patterns
Methods
Options
38. The Radiobutton Widget
When to use the Radiobutton Widget
Patterns
Methods
Options
39. The Scale Widget
When to use the Scale Widget
Patterns
Methods
Options
40. The Scrollbar Widget
When to use the Scrollbar Widget
Patterns
Methods
Options
41. The StringVar Class
When to use the StringVar Class
Patterns
Methods
42. The Text Widget
When to use the Text Widget
Concepts
Patterns
Methods
Options
43. The Toplevel Widget
When to use the Toplevel Widget
Methods
Options
44. Basic Widget Methods
Configuration
Event processing
Event callbacks
Alarm handlers and other non-event callbacks
Window management
Window Related Information
Miscellaneous
Tkinter Interface Methods
Option Database
45. Toplevel Window Methods
Visibility Methods
Style Methods
Window Geometry Methods
Icon Methods
Property Access Methods
Index

Next   


Some Image Processing Tools

Below are some of the image processing tools that would help you in converting the image from one format to another, you can also crop your picture or reduce the size of your image. All these image tools are available at image converter package

Image Converter
TIF/TIFF to JPG Image Converter
TIF/TIFF to PNG Image Converter
WebP to PNG Image Converter
WebP to JPG Image Converter
HEIC to PNG Image Converter
HEIC to JPG Image Converter
PIC to PDF
Image Size Reducer
Resize Your Images Without Losing Quality
Reverse Picture Lookup
Increase Photo Resolution
Pic to Sketch Converter
Photo Collage Maker
Picture Cropper