GUI Button control and event handlers
Makes a button that runs the function show when clicked. Write the function name with no brackets, or it runs straight away instead of on click.
Understanding GUI Button control and event handlers in VCE Software Development U3O1
What it does: command=show hands tkinter the function itself to call later. Writing show() would run it immediately. The handler reads the entry's current text with ent.get() and then changes the label's text using lbl.config(). A handler is an ordinary function that waits to be called by tkinter when the button is clicked. The Entry control's .get() method returns the text the user typed. Entry has no .text attribute to read. Python must know the function name before it is used in command, so the def must come before the tk.Button line.
Common mistakes: Brackets after the function name call go() straight away, before any click. It should be command=go with no brackets so it runs only when the button is clicked. command needs the function itself, not a string. It should be command=hi with no quotes and no brackets.
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 125–141) and word search (Modules 114–141).
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
tk.Button(root, text='Go', command=show)Fill in the Blanks
Spot the Error
Student with a class code? Join your class →