[Tutor] plotting pixels
alan.gauld at btinternet.com
Sun Sep 19 01:39:34 CEST 2010
> It appears that the Tk canvas widget does not support simply plotting a
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
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!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor