hi,

I have the following script to load my art file into a canvas. What I don't understand is that if I tell the script to draw the image at 0 0 on the canvas, the image comes out like it has been shifted up and left. So the upper left of the GIF image isn't visible.

.canv create image $x $y -image $sprites

When I use the center coordinates of the canvas, the image appears normally on the canvas.

set x [expr $max_x/2]
set y [expr $max_y/2]
.canv create image $x $y -image $sprites

Why? I don't understand what the issue is.
Any info would be beneficial.

The complete working script is below.

thanks,

Mike


set filename "/script_dev/BBGAME.gif"
set sprites [image create photo -file $filename]
set max_x [image width $sprites]
set max_y [image height $sprites]

# create the canvas
canvas .canv -width $max_x -height $max_y -background black
pack .canv -side top -expand yes -fill both

# load the image to the canvas
.canv itemconfigure $sprites -image $sprites

set imh [.canv itemcget $sprites -image]


set x [expr $max_x/2]
set y [expr $max_y/2]
.canv create image $x $y -image $sprites