[[...]] What is a tiled image? A tiled image is the behavior of a widget to display one or more repetitions of an image. The number of repetitions depends on the size of the widget and the size of the image. When would I use a tiled image? If one wanted a background that had a ''textured'' feel to it, a small image , tiled, can provide that sort of optical illusion. [BLT] (?) and [Xbit] support tiled images. With the latter, set tiled_image [image create gimg tiledImage -file image_file_name -tile 1] can be used anywhere that a conventional [Tk] image is valid (true?). ---- Saverio Castellano offers, proc SetTiledBackground {cv img} { set h [image height $img] set w [image width $img] set width [$cv cget -width] set height [$cv cget -height] set row [expr $h/2] set col [expr $w/2] while {$row<$height} { set col [expr $w/2] while {$col<$width} { $cv create image $col $row -image $img incr col $w } incr row $h } } ---- [Bryan Oakley] (09 July 2003) provides a different variation which can be bound to the widget's event so it will be retiled as the widget grows # usage: tile canvasWidget ?image? proc tile {canvas args} { set oldImage [$canvas itemcget tile -image] switch -exact [llength $args] { 0 {set image $oldImage} 1 {set image [lindex $args 0]} default { return -code error "usage: tile path ?image?" } } if {$image != $oldImage || [string length $image] == 0} { $canvas delete all } if {[string length $image] == 0} return set imageHeight [image height $image] set imageWidth [image width $image] set width [winfo width $canvas] set height [winfo height $canvas] set x 0 while {$x < $width} { set y 0 while {$y < $height} { # see if there's already a tile here set tags [$canvas gettags $x/$y] if {$tags == ""} { $canvas create image $x $y \ -image $image \ -anchor nw \ -tags [list tile $x/$y] \ } incr y $imageHeight } incr x $imageWidth } } Here's some code to test it: image create photo question -data { R0lGODlhFgAWAIUAAPwCBAQCBCQuNBwiJAwiLAwaJAwSHAwSFIy+3ERynCw2 PCQuPAwmPCxOZCxWdJzG3FSazBwmNAQKDAQGBDRmhBQyTDxujDR2rIy21AwW JDyGxCxmjAwmNDRihAQOFDxmhCxunBQWFAwaLCRahDR6rESGvDQ2PCRWdDRu nDSGvCRSdAwWHCwuLDSOzHSmxDyKxBxCZBwqNHSu1DyOzAQSHAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAAALAAAAAAWABYAAAah QIBwCAgIBAPCoGAgOoeBAyKhWCwYDUf0CX1AIhLiJEGpBLiAAaRxdgYsl7Yb k8igBZoN5xmAdDxoanp8HyANISF8EBsiXBMjJBolBEQmGHFoRScbKHIKDykq K5lFAZRCnyknTaROLA8tq61OChgtKqyzQgEYEJi6UC4vI3LAASkbMBPARAEB dszR0sACEaPSMTIQM8W6KzNl3bo0NOJDdEEAIf5oQ3JlYXRlZCBieSBCTVBU b0dJRiBQcm8gdmVyc2lvbiAyLjUNCqkgRGV2ZWxDb3IgMTk5NywxOTk4LiBB bGwgcmlnaHRzIHJlc2VydmVkLg0KaHR0cDovL3d3dy5kZXZlbGNvci5jb20A Ow== } canvas .c tile .c question bind .c [list tile %W] pack .c -side top -fill both -expand y ---- [DKF]: I prefer to create a single pre-tiled image of the required size when the [canvas] isn't too large; the memory consumption is more, but the script is much shorter... image create photo foo -data {...} $canvas create image 0 0 -anchor nw -image [image create photo foo-tiled] foo-tiled copy foo -to 0 0 [winfo width $canvas] [winfo height $canvas] # Yes, that's all it takes folks! photo image copying tiles for you! ([Bryan Oakley] sez: very impressive! Nice job, Donal) ---- Apparently a variation on all this is the "tile extension" [http://tktable.sourceforge.net/tile/], maintained as a subproject of [tktable]. It "is a testing ground for an improved version of the [Tk] styling engine." It apparently give the ability to create applications with native [GTK] looks. Is the texturing all that people mean when they talk about GTK's appearance? Will the tile extension make it into [8.5]? ---- [ABU]: Here is my little contribution. [tcanvas] is a pure-tcl widget written using [Snit]. Here is a sample [http://web.tiscali.it/irrational/tcl/tcanvas1.0/demo.gif] See also [scanvas] - canvas with scrollbars [tcanvas] - Tiled canvas [tscanvas] - Tiled Scrolling Canvas ---- [Category GUI]