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've done some spin buttons with Glade for my Python/GTK3 app, but I don't know how to set things like default, lower or higher value. How can I do it?

Using the following things for development:

  • Python 2.7.3
  • GTK 3
  • Glade 3.12.1

1) I need to change things from script, as I need to set default value and maximum value as a variable;

2) I saw the PyGTK documentation before, it's not working for GTK3;

3) please don't direct me to the GTK3 docummentation... I can't understand it :P

share|improve this question
up vote 3 down vote accepted

In Glade:

  1. Select the spinbutton.
  2. Click the button next to the "Adjustment" text entry that has "..." in it.
  3. In the window that appears click "New."
  4. Select the "adjustment1" widget from above.
  5. From there you can change value for a default value, minimum value, maximum value, and step increment.

You can also change those values from code, the class refrence can be found here: gtk.SpinButton.

Edit: You can get the maximum and minimum values using the following code:

(min, max) = spinbutton.get_range()

where min is minimum value, max is maximum value, and spinbutton is the spin button widget. You can also set it using the following:

spinbutton.set_range(min, max)
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.