[willdye] On 2005-08-12, [dkf] posted some example code on the Tcl'ers chat, for the benefit of a new person who was asking basic questions about things like the [canvas] widget. The code below is derived from [dkf]'s original example code. It should create a small display of several rooms. As the mouse moves into a room, an event should be triggered, and the name of the room should appear in a label. As the mouse moves out of the room, a event should be triggered, and the label should be blanked out. ---- # Example of using 'bind' to trigger procs on and events. proc makeRoom {widget name polyCoords} { set id [$widget create poly $polyCoords -fill white -outline black] $widget bind $id [list enterRoom $widget $id $name] $widget bind $id [list leaveRoom $widget $id] $widget scale $id 0 0 20 20 } proc enterRoom {widget id name} { $widget itemconfigure Title -text $name $widget itemconfigure $id -fill yellow } proc leaveRoom {widget id} { $widget itemconfigure Title -text "" $widget itemconfigure $id -fill white } proc start {widget} { destroy $widget ; pack [canvas $widget -background white] makeRoom $widget "Bedroom" {1 1 4 1 4 3 1 3} makeRoom $widget "Kitchen" {5 1 9 1 9 3 5 3} makeRoom $widget "Hallway" {4 1 5 1 5 3 9 3 9 4 1 4 1 3 4 3} makeRoom $widget "Recroom" {9 4 9 9 1 7 1 4} $widget create text 40 10 -tag Title } start .c ---- [Category Example] | [Category GUI]