Skip to main content
Loading page…
Python Mastery
Chapter 48
Lesson 2 of 4
Events, Callbacks & State
Contents
Notes
Tutor
Concept
Two Ways to Handle Events
Loading activity…
Previous
1 / 9
Continue
Contents
Notes
Discussion
Tutor
49 min
9 activities
0 of 9 done
In this lesson
1
Two Ways to Handle Events
2
Control Variables: StringVar and IntVar
3
Dialogs: messagebox and filedialog
4
Input Validation
5
Never do heavy work inside a callback
6
StringVar vs direct widget access
7
Events and callbacks quiz
8
Preventing UI freeze
9
Senior Lab: Build, Run, and Review Evidence
Objectives
Learner can attach a callback to a Button using the command option
Learner can bind arbitrary events (key presses, mouse clicks) using widget.bind()
Learner can use StringVar and IntVar to link widget values to Python variables
Learner can open messagebox dialogs and filedialog pickers
Learner can validate Entry input with a Tkinter validation callback
Further reading
tkinter - Python interface to Tcl/Tk
Chapter 48 · Desktop GUIs with Tkinter (and PyQt)
Windows & Widgets
Events, Callbacks & State
Build a Desktop App
Beyond Tkinter
Previous: Windows & Widgets
Next: Build a Desktop App