Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
add comment

1 Answer

up vote 2 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
add comment

Your Answer

 
discard

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.