Posted to tcl by egavilan at Fri Apr 04 22:50:03 GMT 2008view pretty

image at:

here's the code:

if {![file exists [set imgfile [lindex $argv 0]]]} {
        print "Uso: $argv0 filename.gif"

proc animate {img ms} {
        scan [$img cget -format] "GIF -index %d" index
        set fmtstr {$img configure -format "GIF -index %d"}

        incr index
        if {[catch [format $fmtstr $index]]} {
                set index 0
                eval [format $fmtstr $index]

        after $ms [info level 0]

set img [image create photo -file $imgfile -format "GIF -index 0"]
pack [label .l -image $img -padx 20 -pady 20 -bg white]

after 2000 animate $img 50