afhacker
afhacker

Reputation: 23

How to get a widget position inside it's layout in Kivy?

I have a GridLayout and I added some Image widgets on it after adding of images I want to draw a rectangle in each image by using their canvas but I couldn't because I don't know the exact Image widgets positions on GridLayout.

In last line of my Python code : Rectangle(pos = (child.x - 2.4, child.y + 467), size = (70, 70))

How to draw this rectangle in child(My method is not good^),

Also Why my GridLayout not coming in center after setting it's pos_hint = {"center_x" : .5}?

Upvotes: 1

Views: 1611

Answers (1)

Necronomicron
Necronomicron

Reputation: 1310

If I understand question right, try to use such methods as to_local(), to_parent(), to_widget() and to_window(). Also you could try to subtract position of your GridLayout from Widgets' positions.

Upvotes: 1

Related Questions