[Tkinter-discuss] Canvas pixels

Michael Lange klappnase at web.de
Mon Jul 3 23:37:57 CEST 2006

On Mon, 3 Jul 2006 15:22:13 +0000
Cameron Laird <Cameron at phaseit.net> wrote:

> On Sat, Jul 01, 2006 at 08:19:29AM -0500, Jeff Epler wrote:
> 			.
> 			.
> 			.
> > > is there a way to get the RGB color, pixel by pixel, of a tkinter.Canvas?
> > 
> > No, tk doesn't provide a way to do this.
> 			.
> 			.
> 			.
> True.
> This annoyed me so much, though, that I researched it a tiny
> bit more.  The Img extension, as it happens, can snapshot a
> canvas into a photo, and Tkinter itself can report on the
> pixel values in a photo image.
> That's as good as it gets, apparently.  What I don't know is
> whether Tkinter supports Img at all; I must confess that I'm
> only aware of its availability for Tcl/Tk.

Do you mean the tkImg library from <http://sourceforge.net/projects/tkimg/> ?
If so, I have used it successfully by just adding a line

    root.tk.call('package', 'require', 'Img')

(where root of course is my Tk() window).
I have only used it for displaying .png images though, I don't know about this "snapshot" feature.


More information about the Tkinter-discuss mailing list