This repository contains a collection of 14 educational exercises developed with Tkinter, Python's standard library for creating graphical user interfaces (GUI).
This project is a series of progressive exercises ranging from basic concepts to more complex Tkinter applications:
- Practice 1: Basic 1000x500 window
- Practice 2: Window with custom title and background color
- Practice 3: Label with custom styles (font, colors, padding)
- Practice 4: Button that prints messages to the terminal
- Practice 5: Button that changes a label's text
- Practice 6: Text field with button to display the entered name
- Practice 7: Interactive questionnaire with multiple input fields
- Practice 8: 4-frame grid (2x2) with different colors
- Practice 9: Nested frames with an inner button
- Practice 10: Move a label horizontally with buttons
- Practice 11: Selection list (Listbox) with display of selected item
- Practice 12: Simple addition calculator with error validation
- Practice 13: Traffic light simulator with automatic switching and timer
- Practice 14: Full basic calculator with arithmetic operations, keyboard support and validation
These practices cover the following core Tkinter concepts:
- ✅ Creating and configuring windows (
Tk()) - ✅ Basic widgets:
Label,Button,Entry,Listbox,Canvas - ✅ Geometry managers:
pack(),grid(),place() - ✅ Event handling with
commandandbind() - ✅ Layout organization with
Frameand nested frames - ✅ Input data validation
- ✅ Using timers with
after() - ✅ Pop-up messages with
messagebox - ✅ Advanced customization (colors, fonts, styles)
- Realistic traffic light simulation with three lights (red, yellow, green)
- Automatic switching every 5 seconds
- Visual countdown timer
- Design using
Canvasfor graphical representation
- Basic arithmetic operations (+, -, *, /)
- Parentheses and decimal support
- Keyboard shortcuts (Enter, Escape, Backspace)
- Expression validation with error handling
- Modern interface with color-coded buttons
- Clear and delete buttons
Python 3.x
tkinter (included in standard Python installations)- Clone this repository:
git clone https://github.com/TheNarratorVIMMXX/tkinter-practices.git
cd tkinter-practices- Run any practice directly:
python practica_01.py
python practica_14.py # Full calculator- Layout Management: Differences between
pack(),grid()andplace() - Event-Driven Programming: Event handling with callbacks
- Data Validation: Using
try-exceptblocks for user input - Global State: Managing global variables to maintain state
- Timers and Animation: Using
after()for time-based operations - Best Practices: Documentation, descriptive names, logic separation
This project is educational and available for free use for learning purposes.
If you'd like to add more practices or improve existing ones, contributions are welcome!
- Author: Carlos Gabriel Magallanes López
- Email: cgmagallanes23@gmail.com
- Development Date: October 15-16, 2025
⭐ If this repository was helpful, don't forget to give it a star on GitHub!

