[Tutor] Tkinter, how to retrieve information about an object on canvas

Matheus Soares da Silva matheusoares at poli.ufrj.br
Thu Nov 15 03:32:45 CET 2012


Hello, I would like to be able to get information from a Tkinter canvas
object. (color, width, tags, root points, etc),

 I wrote the following function that, with a canvas bind, returns me the
widget that has been clicked on, the widget is returned as a tuple by the
find_overlapping method.

# detecting click
def Hasclicked(e):
    global obj
    global lastClick
    lastClick = [e.x, e.y]
    obj = e.widget.find_overlapping(e.x, e.y, e.x, e.y)

  So, there's any method I can use on 'obj' to get the attributes?

(Tkinter Documentation: http://www.tkdocs.com/tutorial/index.html)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20121115/8b7d3ba5/attachment.html>


More information about the Tutor mailing list