Getting pixel values under cursor

Thinkit aoeu at
Mon Jun 17 06:56:16 EDT 2002

"Bill" <metaliu at> wrote in message news:<adrhgi$mh$1 at>...
> I'm using Tkinter right now for a GUI.  Is there a way for me to get, in
> real time or when the user clicks the mouse button on a pixel, the pixel
> intensity value?  Currently, I have a tkinter label which is showing a large
> grey scale image.  I would like the user to move the mouse cursor over the
> image and show the pixel intensity under the cursor.  Is there a way to do
> this?  Perhaps some kind of event binding with the mouse and the image?
> Would putting the image in a canvas instead provide more flexibility?
> Thanks in advance,
> Bill

Changing the cursor repeatedly will take some considerable background
processing.  Just bind mouse moves to check to see if it's within the
label--if it is, display in a status box, if not, display nothing

More information about the Python-list mailing list