views:

405

answers:

1

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.

+4  A: 

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.

balpha
this looks promising! i'll check it out. you'd think it would be easier to find... like have one of the words "size" "bounds" "width" etc in the function name.
Claudiu
Tell me about it :-)
balpha
...although "will actually be allocated" gives a tiny hint, now that I look at it.
balpha