Changing the Image Displayed (in a label widget, for example) FROM: http://wiki.tcl.tk/876 (imaged on 2009 mar 19) (This page has good info on using mmencode to do base64 encoding, to use in 'image create photo -data ' statements.) An obvious solution would be to destroy .display (below) and recreate it. The problem with this is that the image flickers and is slower. The easiest and best way for most uses is to instruct the set image to read another file or configure the image to read different data. For example #1: -------------- #!/usr/local/bin/wish8.2 #load /usr/local/lib/Img1.2/libimg1.2.so package require Img global picture set picture [image create photo -file picture1.jpg] label .display -image $picture pack .display button .change -text Change -command {new_picture} pack .change proc new_picture {} { global picture $picture read ./picture2.jpg } ---------------------- END OF SAMPLE CODE #1. If you are using embedded images you will need to use configure to change the image. For example #2: --------------- #!/usr/local/bin/wish8.2 #load /usr/local/lib/Img1.2/libimg1.2.so package require Img set image1 { /9j/4AAQSkZJRgABAQEAAQABAAD//gAuIENSRUFUT1I6IFRoZSBHSU1 QJ3MgUE5NIEZpbHRlciBWZXJzaW9uIDEuMAr/2wBDAAgGBgcGBQgHBw cJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxN DQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIy MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL /wAARCAAUABQDASIAAhEBAxEB/8QAFwABAQEBAAAAAAAAAAAAAAAAAA EGB//EABsQAQAABwAAAAAAAAAAAAAAAAACBAUXVJLS/8QAFwEBAQEBA AAAAAAAAAAAAAAAAAcBBv/EAB4RAAECBwEAAAAAAAAAAAAAAACS4gEC BAUVF1NV/9oADAMBAAIRAxEAPwDECW8q2RJbx8lvKtkSW8fLcXZPRlS 46PY9PygtpRLeVbIkt4+Qxdk9GVLhsen5QW06WAmhEwAA/9k= } set image2 { /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDABUOEBIQDRUSERIYFhUZHzQ iHx0dH0AuMCY0TENQT0tDSUhUXnlmVFlyWkhJaY9qcnyAh4iHUWWUn5 ODnXmEh4L/2wBDARYYGB8cHz4iIj6CVklWgoKCgoKCgoKCgoKCgoKCg oKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoL/wAARCAAe AB4DASIAAhEBAxEB/8QAGAAAAwEBAAAAAAAAAAAAAAAAAAMFBgH/xAA kEAABBAEEAQUBAAAAAAAAAAABAAIDEQQFEhMxISJhcYGRwf/EABYBAQ EBAAAAAAAAAAAAAAAAAAIBA//EABwRAQADAQEAAwAAAAAAAAAAAAEAA hEDEiExQf/aAAwDAQACEQMRAD8A2CXPkRY4byOouNNAFlx9gmLPulyN U1Pmw7bFj+jcCNxB7IvwjZya8uftV+iXIZ2Tb9l2x21wIqj3/UxTtMi 1CKZwy5C+MssWQadf70qKo6Q3qVtg7OOG5pb1YpQNNa/TufEzIZeN5s SRtJB+x5WgQom/MVOnka/jJGgY87WyzZIla4upjZHHwPgquhCoYZD0u 3t6Z//Z } global picture set picture [image create photo -data $image1] label .display -image $picture pack .display button .change -text Change -command {new_picture} pack .change proc new_picture {} { global picture image2 $picture configure -data $image2 } ----------------- END OF SAMPLE CODE #2. (DKF: An alternative technique (if you can afford to keep all the needed images in memory) is to simply reconfigure the widget that is using the image to use a different image. This is the fastest way of switching!)