[Tutor] tkinter canvas

Alan Gauld alan.gauld at btinternet.com
Thu Jan 15 19:28:37 CET 2009


"Kent Johnson" <kent37 at tds.net> wrote

> for i in range(numboxes):
>    box[i]=w.create_rectangle((1+i)*40, 40, (2+i)*40, height-40, 
> fill="blue")
>    w.tag_bind(box[i], '<Enter>', lambda e, i=i: enter(e, i))
>    w.tag_bind(box[i], '<Leave>', lambda e, i=i: leave(e, i))

I'm wrong again. I've never noticed tag_bind() before.
Although on investigation it is used by Grayson in his Tkinter book...

I notice it can also be used in the Text widget to catch events on
specific items of text or embedded images etc.

Nice.

Alan G 




More information about the Tutor mailing list