# Create and pack a canvas
pack [canvas .c] -expand yes -fill both
# Create a text object. Save its ID in the
# variable "msg".
set msg [.c create text 10 10 -anchor nw -text "Hello, World!"]
# Create 2 more text objects and assign
# the tag "status" to each of them. You
# can then manipulate both objects by
# using their tag name instead of their IDs
.c create text 10 30 -anchor nw -tags status -text "Here's a line of text"
.c create text 10 50 -anchor nw -tags status -text "Here's some more text"
# Delete the 2 "status" objects by using
# the tag "status".
.c delete status
# Delete the first object creating by
# specifying its ID.
.c delete $msg
# Create another text object and assign it
# the tag "alert".
.c create text 10 10 -anchor nw -tags alert -text "Situation normal"
# Let's replace the text with a new message.
# But instead of deleting the existing object
# and creating a new one, we'll just change
# the configuration of the existing object
# to change the text displayed.
.c itemconfigure alert -text "It's out of control!"