[Image-SIG] Twiddle screen pixels
Stephen J King
king@calibre-dd.com
Tue, 23 Nov 1999 11:52:27 -0500
Forgive a relative PIL newbie if this is a trivial matter, but:
I want to use PIL as a framework for testing image processing algorithm
prototypes written in python. I am trying to write something which will
continuously update the screen image as data is generated. I've modified
one of the PIL demos to this:
#
# painter widget
class PaintCanvas(Canvas):
def __init__(self, master, image):
Canvas.__init__(self, master, width=image.size[0],
height=image.size[1])
self.image = image
self.bind("<B1-Motion>", self.paint)
def paint(self, event):
xy = event.x, event.y
try:
self.image.putpixel(xy,0)
except:
pass
self.update_idletasks()
#
# main
root = Tk()
size=(250,250)
im = Image.new('RGB',size)
PaintCanvas(root, im).pack()
root.mainloop()
###
The problem is that the screen image does not get updated by the
putpixel() call. I would rather not use tiling, as this would add an
unnecessary layer of complexity. Any ideas?
Thanks,
Stephen
-- Stephen J King Technology Manager Calibre Digital Pictures
-- king@calibre-dd.com http://www.calibredigital.com