[Tkinter-discuss] getcolor on Canvas (but without Image)
Gabor Kalman
Kalman_G at msn.com
Sun Nov 16 14:55:50 CET 2008
I have a simple Rectangle drawn on Canvas. For example:
from Tkinter import *
#
class Test(Frame):
#-------------------------------------------------------------
def __init__(self, master=None):
Frame.__init__(self, master)
Pack.config(self)
self.createWidgets()
#------------------------------------------------------------
def createWidgets(self):
self.draw = Canvas(self, width=600, height=400)
self.draw.create_rectangle(100, 100, 200, 150, fill="blue")
self.draw.pack(side=LEFT)
#
test = Test()
test.mainloop()
Question:
=======
How can I retrieve the color on the Canvas AFTER the Rectangle is drawn, say, at the coordinate (110,110) ???
P.S.
Of course if the Rectangle would be an Image (!!!) I could do it with:
from PIL import Image
im = Image.open"Rectangle.jpg")
x=110
y=110
pix = im.load()
print pix[x, y]
But that's NOT what I want.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20081116/1dcdf2a1/attachment.htm>
More information about the Tkinter-discuss
mailing list