Matheus Soares da Silva <matheusoa...@poli.ufrj.br> writes:
> Hello, I would like to be able to get information from a Tkinter
> canvas object. (color, width, tags, root points, etc),
You can get the information of an object on the canvas by passing its id
to certain canvas methods like itemconfigure:

>>> c = Canvas()
>>> c.pack()
>>> c.create_rectangle(30,30,90,90,fill="black")
1
>>> c.itemconfigure(1)

Should yield a dictionary containing the options of the rectangle.

> the widget is returned as a tuple by the find_overlapping method.
Utilising find_overlapping you will get a tuple of multiple object-ids.
To get a single object you index into the tuple:

>>> c.find_overlapping(31,31,33,33)
(1,)
>>> c.itemconfigure(c.find_overlapping(31,31,33,33)[0])


btw. there is also a tkinter specific mailing-list:
tkinter-disc...@python.org

--
Axel Wegen
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to