views:

56

answers:

1

I'm using pyGTK. I want to layout a large element with 2 smaller ones on each side. For aesthetic reasons, I want the 2 smaller ones to be the same size. As it is, they differ by a few pixels, and the middle element is not centered as a result.

I tried using gtk.Table with 3 cells, but having homogeneous=True doesn't have the desired effect. I tried messing with it by making 8 cells, and then having the center one take up more cells, but it doesn't work well. Is there any way to do this?

+5  A: 

You should use GtkSizeGroup for this. Create a GtkSizeGroup, add both widgets to it. This will ensure that both widgets have the same size. If you want that widget have the same size in only one direction (width or height), set the "mode" property of SizeGroup.

dmitry_vk
brilliant! i wish i could give you more votes, since nobody seems to be looking at this question
Claudiu
No, I never had this problem. Could you post a snippet of code?
dmitry_vk
It was silly. I had widget A, and widget B which contained A, and I tried adding both of them to the same size group. It probably went into stack overflow or something.
Claudiu