Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am developing an app using Quickly + Glade + Gtk + Python. I would have liked to know the size of a displayed widget. Here is what I wrote already:

from gi.repository import Gtk, WebKit
self.webview = WebKit.WebView()
print self.webview.size_request()

I had expected a tuple in the form of (100px, 200px) for example. But what I get instead is <GtkRequisition at 0x24607c0>. Why is that? What should I do instead?

It seems that the answer is here, but I unfortunately don't understand it.

share|improve this question
You may want to post your question in Stack Overflow instead of here; Ask Ubuntu is mainly used for user questions, not developer ones. – InkBlend Jun 23 '12 at 19:13
OK thank you. If I get an answer there earlier than here, I'll repost it here. – Agmenor Jun 23 '12 at 19:15
up vote 1 down vote accepted

You probably will want to use width = widget.get_allocation().width to get the width and height = widget.get_allocation().height to get the height as there is a difference between a widgets requested size and it's actual size.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.