diff options
Diffstat (limited to 'library/demos/image2.tcl')
-rw-r--r-- | library/demos/image2.tcl | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/library/demos/image2.tcl b/library/demos/image2.tcl index 7af52be..9691b87 100644 --- a/library/demos/image2.tcl +++ b/library/demos/image2.tcl @@ -55,8 +55,14 @@ proc loadImage {w x y} { global dirName set file [file join $dirName [$w.f.list get @$x,$y]] + set opts [list -file $file] + if {[string tolower [file extension $file]] eq ".svg"} { + lappend opts -format $tk::svgFmt + } else { + lappend opts -format {} + } if {[catch { - image2a configure -file $file + image2a configure {*}$opts }]} then { # Mark the file as not loadable $w.f.list itemconfigure @$x,$y -bg \#c00000 -selectbackground \#ff0000 @@ -94,7 +100,7 @@ labelframe $w.f -text "File:" -padx 2m -pady 2m listbox $w.f.list -width 20 -height 10 -yscrollcommand "$w.f.scroll set" ttk::scrollbar $w.f.scroll -command "$w.f.list yview" pack $w.f.list $w.f.scroll -side left -fill y -expand 1 -$w.f.list insert 0 earth.gif earthris.gif teapot.ppm +$w.f.list insert 0 earth.gif earthris.gif teapot.ppm Tcl.svg bind $w.f.list <Double-Button-1> "loadImage $w %x %y" catch {image delete image2a} |