#!/usr/bin/wish # # from http://wiki.tcl.tk/876 # http://www.tcl.tk/man/tcl8.4/TkCmd/canvas.htm # http://wiki.tcl.tk/1623 # # Open an image and record the pixel coordinates of mouseclicks on it. # Useful for extracting rough numbers from journal figures. # # usage: clickloc.tk imagefile # The image package lets you open more image formats. # You can invoke this package with either of the following lines #load /usr/local/lib/Img1.2/libimg1.2.so #package require Img if { $argc != 1 } { puts "usage: clickloc.tk imagefile" exit 1 } set imagefile $argv set picture [image create photo -file $imagefile] set height [image height $picture] set width [image width $picture] canvas .can -height $height -width $width .can create image 0 0 -image $picture -anchor nw -tag img pack .can .can bind img { puts "%x\t%y" }