gtk.Range — a base class for widgets that allow a user to set a value in a range.
class gtk.Range(gtk.Widget): |
|
|
def callback( | |
def callback( | |
def callback( | |
def callback( |
The gtk.Range
is the base
class for the gtk.Scale
and gtk.Scrollbar
widgets. The gtk.Range
provides
the common functionality for these widgets that allow a user to set a value
in a range of values. The gtk.Scale
works in
conjunction with a gtk.Adjustment
which provides the range information.
def set_update_policy(policy
)
| the update policy:
gtk.UPDATE_CONTINUOUS ,
gtk.UPDATE_DISCONTINUOUS ,
gtk.UPDATE_DELAYED |
The set_update_policy
() method sets the
"update-policy" property to the value specified by
policy
. The update policy has the following values
and effects:
| anytime the range slider is moved, the range value will change and the "value_changed" signal will be emitted. |
| the value will be updated after a brief timeout where no slider motion occurs, so value changes are delayed slightly rather than continuously updated. |
| the value will only be updated when the user releases the button and ends the slider drag operation. |
def get_update_policy()
Returns : | the current update policy |
The get_update_policy
() method gets the
value of the "update-policy" property. The update policy is one of:
gtk.UPDATE_CONTINUOUS
,
gtk.UPDATE_DISCONTINUOUS
or
gtk.UPDATE_DELAYED
. See the set_update_policy
()
method for details.
def set_adjustment(adjustment
)
| a gtk.Adjustment |
The set_adjustment
() method sets the
"adjustment" property to the value specified by
adjustment
. The gtk.Adjustment
is used as the "model" object for this range widget.
adjustment
indicates the current range value, the
minimum and maximum range values, the step and page increments used for
keybindings and scrolling, and the page size. The page size is normally 0
for gtk.Scale
and nonzero for gtk.Scrollbar
,
and indicates the size of the visible area of the widget being scrolled. The
page size affects the size of the scrollbar slider.
def get_adjustment()
Returns : | a gtk.Adjustment |
The get_adjustment
() method returns the
value of the "adjustment" property. See the set_adjustment
()
method for details.
def set_inverted(setting
)
| if True invert the
range |
The set_inverted
() method sets the
"inverted" property to the value specified by
setting
. If setting
is
True
the normal motion of the range widget is reversed.
Ranges normally move from lower to higher values as the slider moves from
top to bottom or left to right. Inverted ranges have higher values at the
top or left rather than on the bottom or right.
def get_inverted()
Returns : | True if the range is
inverted |
The get_inverted
() method returns the
value of the "inverted" property that was set by the set_inverted
()
method.
def set_increments(step
, page
)
| the step size |
| the page size |
The set_increments
() method sets the
step and page sizes for the range to the values specified by
step
and page
respectively.
The step size is used when the user clicks the gtk.Scrollbar
arrows or moves gtk.Scale
via the
arrow keys. The page size is used for example when moving via Page
Up or Page Down keys.
def set_range(min
, max
)
| the minimum range value |
| the maximum range value |
The set_range
() method sets the minimum
and maximum allowable values for the gtk.Range
to that
values specified by min
and
max
respectively. If the range has a non-zero page
size, it is also forced to be between min
and
max
.
def set_value(value
)
| the new value of the range |
The set_value
() method sets the current
value of the range to the value specified by value
.
value
will be forced inside the minimum or maximum
range values. The range emits the "value_changed" signal if the value
changes.
def get_value()
Returns : | the current value of the range. |
The get_value
() method gets the current
value of the range.
def set_fill_level(fill_level
)
| the new position of the fill level indicator. |
The set_fill_level
() method sets
the new position of the fill level indicator.
The "fill level" is probably best described by its most prominent use case, which is an indicator for the amount of pre-buffering in a streaming media player. In that use case, the value of the range would indicate the current play position, and the fill level would be the position up to which the file/stream has been downloaded.
This amount of prebuffering can be displayed on the range's trough and is
themeable separately from the trough. To enable fill level display, use
gtk.Range.set_show_fill_level
().
The range defaults to not showing the fill level.
Additionally, it's possible to restrict the range's slider position to values
which are smaller than the fill level. This is controller by
gtk.Range.set_restrict_to_fill_level
()
and is by default enabled.
def set_restrict_to_fill_level(restrict_to_fill_level
)
| Whether the fill level restricts slider movement. |
The set_restrict_to_fill_level
() method sets
whether the slider is restricted to the fill level. See
gtk.Range.set_fill_level
()
for a general description of the fill level concept.
def get_restrict_to_fill_level()
Returns : | True if range is
restricted to the fill level. |
The get_restrict_to_fill_level
() method gets
whether the range is restricted to the fill level.
def set_show_fill_level(show_fill_level
)
| Whether a fill level indicator graphics is shown. |
The set_show_fill_level
() method sets
whether a graphical fill level is show on the trough. See
gtk.Range.set_fill_level
()
for a general description of the fill level concept.
def get_show_fill_level()
Returns : | True if range shows the
fill level. |
The get_show_fill_level
() method gets
whether the range displays the fill level graphically.
def set_round_digits(round_digits
)
| the precision in digits, or -1. |
This method is available in PyGTK 2.24 and above.
The set_round_digits
() method sets the number of digits
to round the value to when it changes. See "change-value".
def get_round_digits()
Returns : | the number of digits to round to. |
This method is available in PyGTK 2.24 and above.
The get_round_digits
() method gets the number of digits
to round the value to when it changes. See "change-value".
def set_min_slider_size(min_size
)
| The slider's minimum size. |
This method is available in PyGTK 2.22 and above.
The set_min_slider_size
() method sets the minimum size of the range's slider.
This method is useful mainly for GtkRange subclasses.
def get_min_slider_size()
Returns : | The minimum size of the range's slider. |
This method is available in PyGTK 2.22 and above.
The get_min_slider_size
() method gets the minimum size of the range's slider.
This method is useful mainly for GtkRange subclasses.
def get_range_rect()
Returns : | the range rectangle. |
This method is available in PyGTK 2.22 and above.
The get_range_rect
() method returns the area
that contains the range's trough and its steppers.
This method is useful mainly for GtkRange subclasses.
def set_slider_size_fixed(size_fixed
)
| True to make the slider size constant. |
This method is available in PyGTK 2.22 and above.
The set_slider_size_fixed
() method sets whether the
range's slider has a fixed size, or a size that depends on it's adjustment's page
size.
This method is useful mainly for GtkRange subclasses.
def get_slider_size_fixed()
Returns : | True when the range's slider has a fixed size. |
This method is available in PyGTK 2.22 and above.
The get_slider_size_fixed
() method returns whether the
range's slider has a fixed size, or a size that depends on it's adjustment's page
size.
def set_flippable(flippable
)
| True to make the range flippable. |
This method is available in PyGTK 2.22 and above.
The set_flippable
() method sets whether the
range is flippable. If a range is flippable, it will switch its direction if
it is horizontal and its direction is gtk.TEXT_DIR_RTL
.
def get_flippable()
Returns : | >True if the range is flippable. |
This method is available in PyGTK 2.22 and above.
The get_flippable
() method returns whether the
range is flippable.
def set_lower_stepper_sensitivity(sensitivity
)
| the lower stepper's sensitivity policy.. |
The set_lower_stepper_sensitivity
() method sets the
sensitivity policy for the stepper that points to the 'lower' end of the range's
adjustment.
def get_lower_stepper_sensitivity()
Returns : | The lower stepper's sensitivity policy. |
The get_lower_stepper_sensitivity
() method gets the
sensitivity policy for the stepper that points to the 'lower' end of the range's
adjustment.
def callback(range
, value
, user_param1
, ...
)
| the range that received the signal |
| the value |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
The "adjust-bounds" signal is emitted when the range is adjusted by user action. Note the value can be more or less than the range since it depends on the mouse position.
def callback(range
, scroll
, value
, user_param1
, ...
)
| the range that received the signal. the object which received the signal. |
| the type of scroll action that was performed - one of the GTK Scroll Type Constants.. |
| the new value resulting from the scroll action. |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
Returns : | True to prevent other
handlers from being invoked for the signal or
False to propagate the signal
further. |
This signal is available in GTK+ 2.6 and above.
The "change-value" signal is emitted when a scroll action is
performed on a range. It allows an application to determine the type
of scroll event that occurred and the resultant new value. The
application can handle the event itself and return
True
to prevent further processing. Or, by
returning False
, it can pass the event to other
handlers until the default GTK+ handler is reached.
The value parameter is unrounded. An application that overrides the "change-value" signal is responsible for clamping the value to the desired number of decimal digits.
It is not possible to use delayed update policies in an overridden "change-value" handler.
def callback(range
, scrolltype
, user_param1
, ...
)
| the range that received the signal |
| the scroll type issued because a key was pressed by the user; one of the GTK Scroll Type Constants. |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
The "move-slider" signal is emitted when the user presses a key (e.g. Page Up, Home, Right Arrow) to move the slider.
def callback(range
, user_param1
, ...
)
| the range 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 range value is changed either programmatically or by user action.