gtk.Ruler
Prev | The gtk Class Reference | Next

## gtk.Ruler

gtk.Ruler — a base class for horizontal or vertical rulers

## Synopsis

    class gtk.Ruler(gtk.Widget):
        def set_metric(metric)
        def set_range(lower, upper, position, max_size)
        def draw_ticks()
        def draw_pos()
        def get_metric()
        def get_range()

## Ancestry

    +-- gobject.GObject
      +-- gtk.Object
        +-- gtk.Widget
          +-- gtk.Ruler

## gtk.Ruler Properties

gtk.Object Properties

gtk.Widget Properties

"lower" | Read-Write | the lower limit of the ruler
"max-size" | Read-Write | the maximum size of the ruler
"metric" | Read-Write | The metric used for the ruler. This property is available in GTK+ 2.8 and above.
"position" | Read-Write | the position of the mark on the ruler
"upper" | Read-Write | the upper limit of the ruler

## gtk.Ruler Style Properties

gtk.Widget Style Properties

## gtk.Ruler Signal Prototypes

gobject.GObject Signal Prototypes

gtk.Object Signal Prototypes

gtk.Widget Signal Prototypes

## Description

### Note

This widget is considered too specialized or little-used for PyGTK and GTK+, and will in the future be moved to some other package. If your application needs this widget, feel free to use it, as the widget does work and is useful in some applications; it's just not of general interest. However, it will eventually move out of the PyGTK and GTK+ distribution.

The `gtk.Ruler` widget is a base class for horizontal and vertical rulers. Rulers are used to show the mouse pointer's location in a window. Within the ruler a small triangle indicates the location of the mouse relative to the horizontal or vertical ruler. See `gtk.HRuler` to learn about horizontal rulers. See `gtk.VRuler` to learn about vertical rulers.

## Methods

### gtk.Ruler.set_metric

        def set_metric(metric)

`metric` : | the measurement units

The `set_metric`() method sets the measurement units of the ruler to the value specified by `metric`. Available units are `gtk.PIXELS`, `gtk.INCHES`, or `gtk.CENTIMETERS`. The default unit of measurement is `gtk.PIXELS`.

### gtk.Ruler.set_range

        def set_range(lower, upper, position, max_size)

`lower` : | the upper limit of the ruler
`upper` : | the lower limit of the ruler
`position` : | the position of the mark on the ruler
`max_size` : | the maximum size of the rule

The `set_range`() method sets the range of the ruler to the values specified by `lower`, `upper`, `position` and `max_size` (all values are floats).

### gtk.Ruler.draw_ticks

        def draw_ticks()

The `draw_ticks`() method is overridden by the `gtk.Ruler` subclasses (`gtk.HRuler` and `gtk.VRuler`) to draw the tick marks on the ruler. This method is not used by applications.

### gtk.Ruler.draw_pos

        def draw_pos()

The `draw_pos`() method is overridden by the `gtk.Ruler` subclasses (`gtk.HRuler` and `gtk.VRuler`) to draw the position mark on the ruler. This method is not used by applications.

### gtk.Ruler.get_metric

        def get_metric()

Returns : | the measurement units currently used for the ruler

The `get_metric`() method returns the units used for a `gtk.Ruler`. See the `set_metric`() method.

### gtk.Ruler.get_range

        def get_range()

Returns> : | a tuple containing: the lower limit of the ruler, the upper limit of the ruler, the current position of the mark on the ruler and the maximum size of the ruler used when calculating the space to leave for the text.

The `get_range`() method returns a tuple containing the values indicating the range and current position of a `gtk.Ruler`. See the `set_range`() method.

Prev | Up | Next
gtk.Requisition | Home | gtk.Scale