Posted to tcl by patthoyts at Tue Feb 26 20:15:41 GMT 2008view raw

  1. # Quick img viewer: call with path to image file as command line arg
  2. package require Tk
  3. package require Img
  4.  
  5. proc Main {filename} {
  6. set img [image create photo -file $filename]
  7. label .image -image $img
  8. button .b0 -text Button0
  9. button .b1 -text Button 1
  10. grid .image - - -sticky news
  11. grid .b0 .b1 -sticky e
  12. grid rowconfigure . 0 -weight 1
  13. grid columnconfigure . 0 -weight 1
  14. }
  15.  
  16. if {!$tcl_interactive} {
  17. set r [catch [linsert $argv 0 Main] err]
  18. if {$r} {tk_messageBox -message $err}
  19. exit $r
  20. }