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

Trying to create the framework for a calculator.

I add the window I add the vbox using 2 boxes. 1 for the display, the other for the buttons When I add 1 button it fills the entire panel and I can't resize it.

In visual basic you can just add a button and resize it, or drag and drop anywhere you want.

I just can't figure out how to do it here. Steep learning curve for me.

share|improve this question
up vote 1 down vote accepted

GTK+ uses box-based sizing, just like CSS and other modern tools. Also, a VBox will have all its children oriented vertically. You won't be able to add anything to the right.

You can use the GtkLayout for absolute positioning, or a GtkGrid to create a grid-based layout (which is appropriate for calculator).

share|improve this answer
That's closer to what I was looking for. Thx. But you still can't do drag and drop like in visual basic. Your pretty constrained in GTK but once I get used to it I am sure it will grow on me. This could be the reason some people use QT but to me QT is for KDE. – Steve Sauls Feb 11 '13 at 19:17

You have two options:

  1. In the lower vbox pane, add a 'Grid' container. Your buttons will have all the same size and scale automatically with the window. There, you can increase the gaps between them by playing with the padding and border properties.
  2. Alternatively, add a 'Fixed' container. This will have the same behaviour as in visual basic, but it is not the gtk way.
share|improve this answer
Your response helped me also. Thx for the help – Steve Sauls Feb 11 '13 at 19:18

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.