10

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.

Claudiu
  • 224,032
  • 165
  • 485
  • 680

1 Answers1

15

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
  • 50,022
  • 18
  • 110
  • 131
  • 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 Aug 05 '09 at 16:24
  • ...although "will actually be allocated" gives a tiny hint, now that I look at it. – balpha Aug 05 '09 at 17:14