Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

displaying image sequence in canvas

Status
Not open for further replies.

nobyfr

Programmer
Sep 13, 2004
2
FR
Well, I'm quite new to Tcl/Tk. I'm developping a soft designed to follow edges in a sequence of pictures and I chose Tcl/Tk to make the GUI. I display the images in a canvas, as I have to draw lines over them (the edges). I have no problem to load the first picture and initialize the edge, but when i run the sequence, the canvas seems not to be refreshed : I only see the last picture, and the first picture remains in the window during the whole sequence. Here's the code used to display the next picture:

Code:
.img configure -file $nom
wm title . "$nom"
pack .canvas

where .img is an image I've created before with

Code:
image create photo .img -file $fichier
set height [image height .img]
set width [image width .img]
.canvas configure -height $height -width $width
wm title . "$fichier"
set id_image [.canvas create image 0 0 -image .img -anchor nw]

Thanks for your help!!
 
It looks like you set up your canvas to have one (and only one) image:
set id_image [.canvas create image 0 0 -image .img -anchor nw]
and then:
.img configure -file $nom

That is, your canvas contains ".img" and you keep changing which file ($nom) is linked to .img.

You need to have the ".canvas create image ..." stuff inside the same loop as $nom.

Bob Rashkin
rrashkin@csc.com
 
Thanks Bong, but I found where was the problem. In fact,
Tcl/Tk updates the display when he has time. If you want to
force him to refresh the display, you have to add

Code:
update idletasks

thus he will refresh the display immediately, no matter
what event or computing he has to do..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top