O
O
OmegaTortik2021-11-12 11:34:25
Python
OmegaTortik, 2021-11-12 11:34:25

How to find object by coordinates in tkinter?

Hello! Help me please! I need to find objects by coordinates in tkiner. How is it possible to implement it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2021-11-12
@OmegaTortik

All that comes to my mind is to go through all the widgets and find those whose rectangle contains the desired point.
winfo_x()/winfo_y() - the position of the widget relative to the parent widget.
winfo_rootx()/winfo_rooty() - if I'm not confused, the position of the widget relative to the beginning of the screen.
winfo_width()/winfo_height() - current widget size
winfo_children() - list of child widgets for this widget.
But why did you need it? Maybe there is an easier way?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question