I tried the following test (see snippet hereunder):
and it always returns 0 regardless of the fact that the canvas object (the rectangle in this case) has been created (with "create") or deleted (with "delete").
Is there another way to check if a canvas object exists or has successfully been deleted in Tcl/Tk ?
Thanks !
Serge Hulne
############
tk::canvas .can
set r1 [.can create rect 30 10 120 80 -outline #fb0 -fill #fb0]
set r2 [.can create rect 150 10 240 80 -outline #f50 -fill #f50]
set r3 [.can create rect 270 10 370 80 -outline #05f -fill #05f]
pack .can
##
##info exists does not work for canvas elements : it always returns 0
set rcc [info exists $r2]
puts "rcc = $rcc"
if {[info exists $r2]} {
puts "$r2 exists !"
.can delete $r2
puts [info exists $r2]
} else {
puts "$r2 does not exist !"
set rc [info exists $r2]
puts "rc = $rc "
}
##
##
wm title . "colors"
wm geometry . 400x100+300+300
##########