Event triggers changing the user interface
A handler runs when an event happens and can call config() to change the interface, such as updating a label's text to give the user feedback.
Understanding Event triggers changing the user interface in QCE Digital Solutions Unit 1
What it does: The handler runs on a keyboard event and uses config() to change the label text to the key's name. Updating a label tells the user that their click or key press was received and what happened. config() changes the widget it is called on. Here that is msg, not the button. You cannot join a string and an integer with +. Converting the score with str() avoids a TypeError. Text given to config() is a string, so it must be wrapped in quotes.
Common mistakes: The option that sets a label's text is text, not txt. It should be label.config(text='Done'), otherwise tkinter raises an error and the label never updates. Setting an attribute called text does not change what the label shows on screen. Use label.config(text=key) so the handler updates the interface.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 158–380) and word search (Modules 82–380).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
label.config(text='Done')Fill in the Blanks
Spot the Error
Student with a class code? Join your class →