Thanks for your reply, Lion. What I want to do is to select a region of interest (ROI) in a given image. I can display the image in a canvas widget and use canvas.create_#object#() method to generate an ROI on the screen. However, I could not find a way to get all pixel coordinates inside the ROI. I have found that canvas.coors() returns pixel coordinates but they do not normally form a close contour. What I was wondering is whether there is a simple way to get all pixels inside an object that is created by canvas.create_#object#() method.
I see your suggestion is a possible way: get the bbox() return values for the object and test each pixel (or a small box) to see whether or not it is inside the object. But are there easier and more direct ways to do this? Yahui On Mon, 2011-06-20 at 23:39 -0700, Lion Kimbro wrote: > > I'm not sure what you mean, but perhaps you are looking for: > > canvas.find_enclosed(x1, y1, x2, y2) => [objID, objID, ...] > completely enclosed > canvas.find_overlapping(x1, y1, x2, y2) => [objID, objID, ...] > sharing at least 1 point > > ..? > > > On Mon, Jun 20, 2011 at 7:59 PM, <yah...@uchicago.edu> wrote: > Hi there, > > I have been struggling to find a way to retrieve all pixel > coordinates that are enclosed by an object drawn on a canvas > widget. Anyone knows how I can do it? > > Thanks, > Yahui > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss@python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss