Find out a widget's position in a Grid


Is there a way to find out a widget’s position within a Gtk.Grid? More practically, I’d like to drag and drop a widget next to another one, and know on which row that one is…

What I’m currently thinking is having as a drop area an eventbox that stores the row number but I wonder whether there isn’t something built in.

In GTK3, you can use Container.child_get (or child_get_property) on the grid and child, with the properties "left-attach" and "top-attach".

In GTK4 this is replaced with Grid.query_child.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.