Permalink
Browse files

anigif fixed to accept ttk::label

  • Loading branch information...
pulpofred
pulpofred committed Apr 6, 2016
1 parent fcea780 commit 94e199e294c9fdb433b319f077f3fef5decc0d1c
Showing with 7 additions and 7 deletions.
  1. +4 −0 sklib/anigif.tcl
  2. +3 −7 sklib/img.tcl
@@ -78,6 +78,8 @@ namespace eval anigif {
default { puts "no match: $dispflag" }
}
[set ::anigif::${w}(curimage)] copy [lindex $list $idx] -subsample 2 2
# fruho fix: need to reassign image to widget to make it work for ttk::label
$w configure -image [set ::anigif::${w}(curimage)]
if { [lindex $delay $idx] == 0 } {
::anigif::stop $w
return
@@ -163,6 +165,8 @@ namespace eval anigif {
proc stop {w} {
catch {
[set ::anigif::${w}(curimage)] blank
$w configure -image [set ::anigif::${w}(curimage)]
after cancel [set ::anigif::${w}(loop)]
}
}
@@ -85,13 +85,9 @@ proc ::img::place {imgptr lbl {imgptr_default 16/missing}} {
}
anigif::stop $lbl
if {[::img::ext $imgptr] eq ".gif"} {
# must use non-ttk label $lbl for proper animated gif display
if {[winfo class $lbl] eq "Label"} {
anigif::anigif [::img::path $imgptr] $lbl
dict set anigif_lbl2img $lbl $imgptr
} else {
error "img::place: You should use plain label (not ttk::label) to display animated gif"
}
# can use both label and ttk::label now (after fixing anigif)
anigif::anigif [::img::path $imgptr] $lbl
dict set anigif_lbl2img $lbl $imgptr
} else {
$lbl configure -image [::img::load $imgptr]
}

0 comments on commit 94e199e

Please sign in to comment.