user3060854
user3060854

Reputation: 933

accessing the contents of a kivy GridLayout by coordinates?

Is there a way to access the contents of a kivy GridLayout or BoxLayout by coordinates, like accessing the element of the second row, third column.

If not, which I'm afraid is the case, is there something in kivy I could use instead?

Upvotes: 0

Views: 755

Answers (2)

Lo Bellin
Lo Bellin

Reputation: 502

Have you seen "simple table layout" in the Garden? It says "SimpleTableLayout.cell(row, col) returns widget at that position in the grid" within the description. You should give it a try!

Upvotes: 0

jligeza
jligeza

Reputation: 4693

You can check all children of a layout widget in a loop, if one of them returns True for the self.collide_point(x,y) method.

Upvotes: 3

Related Questions