[Tutor] plotting pixels

pierre dagenais eq742 at ncf.ca
Mon Sep 20 12:35:13 CEST 2010


On 10-09-18 07:39 PM, ALAN GAULD wrote:
> > It appears that the Tk canvas widget does not support simply 
> plotting a pixel.
>
> Correct, and I agree it seems odd, but in practice drawing either 
> lines or
> ovals of one-pixel do the equivalent job - albeit a little more slowly.
>
> > The primitive obviously exists in the underlying code,
>
> It probably exists in the native graphics toolkit (Xlib or Win32 or Aqua)
> but it doesn't exist at the Tk level which is why Tkinter can't expose it.
>
> FWIW wxPython does provide a DrawPoint() method as part of its
> DeviceContext class.
>
> Digging a little deeper it seems the idiomatic way to do this in Python
> is to use PIL the Python Imaging Library to create a GIF or bitmap
> image and then insert that into Tkinters cancvas as an image object.
>
> The Pil ImageDraw class has a point() ethod
>
> I've never tried this but it is described in Grayson's (now out of 
> print?)
> book on Tkinter where he uses it to draw a Mandelbrot....
> The book may be available online these days...
>
> Nowdownloadall.com seems to have it although I've no idea
> of the legality of it!
>
> HTH,
>
> Alan G.
>
Here's a link, just don't download everything. It would be excessively 
large.

http://isohunt.com/download/212380933/%22Python+and+Tkinter+Programming%22.torrent


More information about the Tutor mailing list