gtk.Adjustment — an object representing an adjustable bounded value
class gtk.Adjustment(gtk.Object): |
These properties are available in GTK+ 2.4 and above. The GTK+ version is contained in the 3-tuple gtk.gtk_version.
|
|
"changed" | def callback( |
def callback( |
The gtk.Adjustment
object contains a value which has an associated lower and upper bound,
together with step and page increments, and a page size. It is used in
conjunction with several PyGTK widgets, including gtk.SpinButton
,
gtk.Viewport
,
and gtk.Range
(which
is a base class for gtk.HScrollbar
,
gtk.VScrollbar
,
gtk.HScale
, and
gtk.VScale
).
A gtk.Adjustment
can be shared by multiple widgets. The gtk.Adjustment
object does not update the value itself. Instead it is left up to the
associated widget(s) that use the gtk.Adjustment
to control the value.
The widget using the gtk.Adjustment
typically calls the value_changed
()
or changed
()
methods after changing the value or its bounds. This results in the emission
of the "value_changed" or "changed" signal respectively.
A gtk.Adjustment
object contains several attributes that provide access to its value and
bounds:
The attribute values can be retrieved and set similar to:
adjustment.upper = 25.0 lower = adjustment.lower
gtk.Adjustment(value
=0, lower
=0, upper
=0, step_incr
=0, page_incr
=0, page_size
=0)
| the initial value. |
| the minimum value. |
| the maximum value. |
| the step increment. |
| the page increment. |
| the page size. |
Returns : | a new gtk.Adjustment object |
gtk.Adjustment
() creates a new gtk.Adjustment
object with the specified attributes. Any attributes not specified are set
to 0.0 by default.
def set_all(value
, lower
, upper
, step_increment
, page_increment
, page_size
)
| the new value. |
| the new minimum value. |
| the new maximum value. |
| the new step increment. |
| the new page increment. |
| the new page size. |
The set_all
() method sets the
attributes of the adjustment to the specified values.
def changed()
The changed
() method emits a "changed"
signal from the adjustment. This must typically be called if any of the
adjustment attributes other than value has changed so that the widget(s)
using the adjustment can reflect the changes. Applications usually will not
need to use this method since setting the attributes directly will automatically
invoke this method.
def value_changed()
The value_changed
() method emits a
"value_changed" signal from the adjustment. This must typically be called
after the value attribute of the adjustment has changed. Applications
usually will not need to use this method since setting the attribute
directly will automatically invoke this method as will using the set_value
()
method.
def clamp_page(lower
, upper
)
| the lower value |
| the upper value |
The clamp_page
() method updates the
adjustment value to ensure that the range between
lower
and upper
is in the
current page (i.e. between value and value + page_size). If the range is
larger than the page size, then only the start of it will be in the current
page. A "changed" signal will be emitted if the value is changed.
def get_value()
Returns : | The current value of the adjustment. |
The get_value
() method gets the current
value of the adjustment.
def set_value(value
)
| the new value |
The set_value
() method sets the value
of the adjustment to the specified value
.
def configure(value
, lower
, upper
, step_increment
, page_increment
, page_size
)
| the new value. |
| the new minimum value. |
| the new maximum value. |
| the new step increment. |
| the new page increment. |
| the new page size. |
This method is available in PyGTK 2.14 and above.
The configure
() method sets all properties of the adjustment at once.
This method is an alternative to avoid multiple emissions of the "changed" signal. When setting multiple
adjustment properties via their individual setters, multiple "changed" signals will be emitted. However, since the
emission of the "changed" signal is tied to the emission of the "GObject::notify" signals of the changed properties,
it's possible to compress the "changed" signals into one by calling
gobject.Gobject.freeze_notify
gobject.Gobject.thaw_notify
def get_lower()
Returns : | The current minimum value of the adjustment. |
This method is available in PyGTK 2.14 and above.
The get_lower
() method gets the current minimum
value of the adjustment.
def set_lower(lower
)
| the new minimum value |
This method is available in PyGTK 2.14 and above.
The set_lower
() method sets the minimum value of the adjustment.
When setting multiple adjustment properties via their individual setters, multiple "changed" signals will be emitted. However, since the emission of the "changed" signal is tied to the emission of the "GObject::notify" signals of the changed properties, it's possible to compress the "changed" signals into one by calling gobject.Gobject.freeze_notify() and gobject.Gobject.thaw_notify() around the calls to the individual setters.
Alternatively, using gtk.Adjustment.configure() has the same effect of compressing "changed" emissions.
def get_page_increment()
Returns : | The current page increment of the adjustment. |
This method is available in PyGTK 2.14 and above.
The get_page_increment
() method gets the current page
increment of the adjustment.
def set_page_increment(page_increment
)
| the new page increment value |
This method is available in PyGTK 2.14 and above.
The set_page_increment
() method sets the page increment of the adjustment.
See gtk.Adjustment.get_lower() about how to compress multiple emissions of the "changed" signal when setting multiple adjustment properties.
def get_page_size()
Returns : | The current page size of the adjustment. |
This method is available in PyGTK 2.14 and above.
The get_page_size
() method gets the current page
size of the adjustment.
def set_page_size(page_size
)
| the new page size value |
This method is available in PyGTK 2.14 and above.
The set_page_size
() method sets the page size of the adjustment.
See gtk.Adjustment.get_lower() about how to compress multiple emissions of the "changed" signal when setting multiple adjustment properties.
def get_step_increment()
Returns : | The current step increment of the adjustment. |
This method is available in PyGTK 2.14 and above.
The get_step_increment
() method gets the current step
increment of the adjustment.
def set_step_increment(step_increment
)
| the new step increment value |
This method is available in PyGTK 2.14 and above.
The set_step_increment
() method sets the step increment of the adjustment.
See gtk.Adjustment.get_lower() about how to compress multiple emissions of the "changed" signal when setting multiple adjustment properties.
def get_upper()
Returns : | The current minimum value of the adjustment. |
This method is available in PyGTK 2.14 and above.
The get_upper
() method gets the current minimum
value of the adjustment.
def set_upper(upper
)
| the new maximum value |
This method is available in PyGTK 2.14 and above.
The set_upper
() method sets the maximum value of the adjustment.
Note that values will be restricted by upper - page-size if the page-size property is nonzero.
See gtk.Adjustment.get_lower() about how to compress multiple emissions of the "changed" signal when setting multiple adjustment properties.
def callback(adjustment
, user_param1
, ...
)
| the object that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
The "changed" signal is emitted when one (or more) of the adjustment attributes (except the value attribute) has changed.
def callback(adjustment
, user_param1
, ...
)
| the object that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
The "value-changed" signal is emitted when the adjustment value attribute has changed.