Friday, July 20, 2018

PyGTK - Adjustment Class

PyGTK - Adjustment Class

Some widgets in PyGTK toolkit are such that their properties can be adjusted over a specified range by the user by using a mouse or a keyboard. A widget like Viewport is used to display some adjustable portion of a large data, for example, a multiline text in TextView control.
PyGTK uses gtk.Adjustment object to be used in association with such widgets so that user adjustments are passed to some callback function for processing. An Adjustment object contains lower and upper bounds of an adjustable value and its increment step paramaters. When parameters of adjustment object changes, it emits changed or value_changed signals.
The following is the constructor of the gtk.Adjustment class −
gtk.Adjustment(value = 0, lower = 0, upper = 0, step_incr = 0, 
   page_incr = 0, page_size = 0)
The meaning of each of the attributes in the constructor is as follows −
valueThe initial value
lowerThe minimum value
upperThe maximum value
step_incrThe step increment
page_incrThe page increment
page_sizeThe page sizes
The following signals are emitted by the Adjustment object −
ChangedThis is emitted when one (or more) of the adjustment attributes (except the value attribute) has changed.
Value-changedThis is emitted when the adjustment value attribute has changed.
As mentioned above, the Adjustment object is not a physical widget. Rather, it is used in association with the other widgets using which its attributes get changed. Range widgets are used along with the Adjustment object.

No comments:

Post a Comment