gtk.Scale — a base class for the scale widgets.
class gtk.Scale(gtk.Range): |
|
|
The gtk.Scale
widget is
an abstract base class, used only for deriving the subclasses gtk.HScale
and gtk.VScale
. A gtk.Scale
is a slider
control used to select a numeric value. Since gtk.Scale
is a
subclass of gtk.Range
, see the
gtk.Range
methods for additional methods. To set the value of a scale, you would
normally use set_value
().
To detect changes to the value, you would normally use the "value_changed"
signal.
def set_digits(digits
)
| the number of decimal places to display |
The set_digits
() method sets the
"digits" property to the value specified by digits
.
The value of digits
specifies the number of decimal
places that are displayed in the value. The value of the adjustment is also
rounded off to this number of digits if "draw-value" is
True
, so the retrieved value matches the value the user
sees. If the "draw-value" property has been set to False
by using the set_draw_value
()
method, the adjustment value will not be rounded at all.
def get_digits()
Returns : | the number of decimal places that are displayed. |
The get_digits
() method returns the
value of the "digits" property that indicates the number of decimal places
that are displayed in the value.
def set_draw_value(draw_value
)
| If True draw the current
value next to the slider |
The set_draw_value
() method sets the
"draw-value" property to the value specified by
draw_value
. If draw_value
is
True
the current value is displayed next to the
slider.
def get_draw_value()
Returns : | True if the current value is
to be drawn next to the slider |
The get_draw_value
() method returns the
value of the "draw-value" property. If "draw-value" is
True
the current scale value is drawn next to the
slider.
def set_value_pos(pos
)
| the position where the current value is displayed. |
The set_value_pos
() method sets the
value of the "value-pos" property to the value specified by
pos
. The value of pos
must be
one of: gtk.POS_LEFT
, gtk.POS_RIGHT
,
gtk.POS_TOP
or gtk.POS_BOTTOM
.
def get_value_pos()
Returns : | the position where the current value is displayed. |
The get_value_pos
() method returns the
value of the "value-pos" property. See the set_value_pos
()
method.
def get_layout()
Returns : | the pango.Layout
for this scale or None if the draw_value
property is False . |
This method is available in PyGTK 2.4 and above.
The get_layout
() method returns the
pango.Layout
used to display the scale.
def get_layout_offsets()
Returns : | a 2-tuple containing the coordinates where the
scale will draw the pango.Layout
representing the text in the scale |
This method is available in PyGTK 2.4 and above.
The get_layout_offsets
() method returns
a 2-tuple containing the coordinates where the scale will draw the pango.Layout
representing the text in the scale. Remember when using the pango.Layout
function you need to convert to and from pixels using the pango.PIXELS
()
function or pango.SCALE
. If the "draw-value" property is
False
, the return values are undefined.
def add_mark(value
, position
, markup
)
| the value at which the mark is placed, must be between the lower and upper limits of the scales' adjustment. |
| where to draw the mark. For a horizontal scale, gtk.POS_TOP is drawn above the scale,
anything else below. For a vertical scale, gtk.POS_LEFT is drawn to the left of the scale, anything else
to the right. |
| text to be shown at the mark, using Pango markup, or None . |
This method is available in PyGTK 2.16 and above.
The add_mark
() method adds a mark at value.
A mark is indicated visually by drawing a tick mark next to the scale, and GTK+
makes it easy for the user to position the scale exactly at the marks value.
If markup is not None
, text is shown next to the tick mark.
To remove marks from a scale, use clear_marks
().
def clear_marks()
This method is available in PyGTK 2.16 and above.
The clear_marks
() method removes any marks that have been
added with add_mark
().
def callback(scale
, value
, user_param1
, ...
)
| the scale that received the signal |
| the value to be formatted |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
Returns : | a string representing
value for display |
The "format-value" signal is emitted when the scale is being
redrawn with a value displayed. The "format-value" signal handler should
return a formatted string containing value
.