tags:

views:

41

answers:

2

I want to add a widget to the bottom of a scrolled window, then scroll to the bottom of that window. However, the window thinks it is already at the bottom, because the widget has still not been allocated. I.e., this returns -1:

widget.get_allocation().y

Why is this? Is there any way to force the widget to be allocated immediately, so I can adjust the window accordingly? Or is there a better solution?

A: 

I'm not 100% sure I understand what you're trying to do, but still: At a minimum, you need to realize the widget to get it to compute those things. But see the note in the linked-to documentation, and investigate if those ways don't work better.

unwind
+1  A: 

The better solution is to hook up to the widget's size-allocate signal and defer your scrolling calculation until then.

anthony
This works perfectly. Thank you!
Matthew