The script below for the procedures are simple and largely self-explanatory:
proc showName {c} {
global is1
$is1.country delete 0 end
$is1.country insert end $c
}
# given a country flash that in canvas
proc highLightCountry { w tn } {
set old_colour [lindex [$w itemconfig $tn -fill] 4]
$w itemconfigure $tn -fill yellow
after 5000 "$w itemconfigure $tn -fill $old_colour; bell"
}
proc clearCanvas {w} {
foreach id [$w find all] {$w delete $id }
}
When the user presses and releases the left mouse button within the borders of a country, the procedure "showName" is invoked to clear (0 to end deletes first to last characters) the entry widget in the application and to insert the name of the country that was passed to the procedure as argument.
The procedure "highLightCountry" takes the names of the canvas widget and the tag input via the entry widget.
The widget command is used to invoke the "itemconfig" action; "itemconfig" gets the list of all the current configuration and their values of the given item in the canvas widget. From this list the current colour of the tagged irtem is retrieved and assigned to old colour. The tagged region (item) is filled with the colour yellow. After 5 seconds, the old colour is reset.
You can of course make the named country flash by rewriting this procedure to set and rest the old and new colours alternatively every so often. Experiment.
The procedure clearCanvas gets the list of all items displayed in the canvas and deletes them.