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

  1. image at:
  2. http://www.eats-edu.com.ar/sva/modulo_1_archivos/4-Stroke-Engine.gif
  3.  
  4. here's the code:
  5.  
  6. if {![file exists [set imgfile [lindex $argv 0]]]} {
  7. print "Uso: $argv0 filename.gif"
  8. exit
  9. }
  10.  
  11. proc animate {img ms} {
  12. scan [$img cget -format] "GIF -index %d" index
  13. set fmtstr {$img configure -format "GIF -index %d"}
  14.  
  15. incr index
  16. if {[catch [format $fmtstr $index]]} {
  17. set index 0
  18. eval [format $fmtstr $index]
  19. }
  20.  
  21. after $ms [info level 0]
  22. }
  23.  
  24. set img [image create photo -file $imgfile -format "GIF -index 0"]
  25. pack [label .l -image $img -padx 20 -pady 20 -bg white]
  26.  
  27. after 2000 animate $img 50