Responding to mouse events
Runs the handler function when the left mouse button is clicked on that widget. The handler receives an event with event.x and event.y. Use '<Double-Button-1>' for a double click.
Understanding Responding to mouse events in QCE Digital Solutions Unit 1
What it does: The handler takes an event parameter, and event.x and event.y hold the click position in the widget. Pass the function name without brackets. bind() calls the handler for you when the click happens. Adding () would run it straight away. tkinter uses '<Button-1>' for the left button. '<Left-Click>' is not a real event name. x and y are not defined variables here. The position must be read from the event object as event.x and event.y.
Common mistakes: x and y are not defined variables. The mouse position is stored on the event object, so the line should be print(event.x, event.y). bind() passes an event object to the handler, so the function needs an event parameter. It should be def hello(event): or the click causes a TypeError.
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
widget.bind('<Button-1>', handler)Fill in the Blanks
Spot the Error
Student with a class code? Join your class →