"Mr Gerard Kelly" <s4027...@student.uq.edu.au> wrote
All it does take a number (6 in this case) and draw that number of
blue
boxes on a canvas.
I want to be able to bind these boxes to an event - so that I can
either
click on them, or hold the mouse cursor over them, and have them
change
color.
I don;t think you can bind events to an object on a canvas, the events
can only be bound to the canvas.
So you would need to determine which object was being highlighted
using the x,y coordinates of the event at the canvas level and then
manipulate the shapes accordingly. This might be easier if you create
a series of shape objects and hold a list of those. You can then
iterate
over the list to lovcate which object contains the point and that
object
can update itself. This also makes handling the case of overlapping
objects easier.
There might be a more Tkinter'ish way of doing this but I've not come
across it.
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor