9
votes

First I looked at the get_size_request method. The docs there end with:

To get the size a widget will actually use, call the size_request() instead of this method.

I look at size_request(), and it ends with

Also remember that the size request is not necessarily the size a widget will actually be allocated.

So, is there any function in GTK to get what size a widget actually is? This is a widget that is on-screen and actually being displayed, so GTK definitely has this information somewhere.

1

1 Answers

15
votes

This should be it (took some time to find):

The get_allocation() method returns a gtk.gdk.Rectangle containing the bounds of the widget's allocation.

From here.