gtk.Curve

gtk.Curve — allows direct editing of a curve.

Synopsis

class gtk.Curve(gtk.DrawingArea):
    gtk.Curve()
def reset()
def set_gamma(gamma)
def set_range(min_x, max_x, min_y, max_y)
def get_vector(size=-1)
def set_vector(vector)
def set_curve_type(type)

Ancestry

+-- gobject.GObject
  +-- gtk.Object
    +-- gtk.Widget
      +-- gtk.DrawingArea
        +-- gtk.Curve

gtk.Curve Properties

gtk.Object Properties

gtk.Widget Properties

"curve-type"Read/WriteThe curve type. One of linear (gtk.CURVE_TYPE_LINEAR), spline interpolated (gtk.CURVE_TYPE_SPLINE), or free-form (gtk.CURVE_TYPE_FREE).
"max-x"Read/WriteThe maximum possible value for X
"max-y"Read/WriteThe maximum possible value for Y
"min-x"Read/WriteThe minimum possible value for X
"min-y"Read/WriteThe minimum possible value for Y

gtk.Curve Style Properties

gtk.Widget Style Properties

gtk.Curve Signal Prototypes

gobject.GObject Signal Prototypes

gtk.Object Signal Prototypes

gtk.Widget Signal Prototypes

"curve-type-changed" def callback(curve, widget, user_param1, ...)

Description

Note

This widget is considered too specialized or little-used for PyGTK, 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 distribution.

The gtk.Curve widget allows the user to edit a curve covering a range of values. It is typically used to fine-tune color balances in graphics applications like the Gimp. The gtk.Curve widget has 3 modes of operation - spline, linear and free. In spline mode the user places points on the curve which are automatically connected together into a smooth curve. In linear mode the user places points on the curve which are connected by straight lines. In free mode the user can draw the points of the curve freely, and they are not connected at all.

Constructor

    gtk.Curve()
Returns :a new gtk.Curve object

Creates a new gtk.Curve object

Methods

gtk.Curve.reset

    def reset()

The reset() method resets the curve to a straight line from the minimum x and y values to the maximum x and y values (i.e. from the bottom-left to the top-right corners). The curve type is not changed.

gtk.Curve.set_gamma

    def set_gamma(gamma)
gamma :the gamma value

The set_gamma() method recomputes the entire curve using the value in gamma. A gamma value of 1 results in a straight line. Values greater than 1 result in a curve above the straight line. Values less than 1 result in a curve below the straight line. The curve type is changed to gtk.CURVE_TYPE_FREE.

gtk.Curve.set_range

    def set_range(min_x, max_x, min_y, max_y)
min_x :the new minimum x value
max_x :the maximum x value.
min_y :the new minimum y value
max_y :the maximum y value.

The set_range() method sets the "min-x", "min-y", "max-x" and "max-y" properties from min_x, min_y, max_x, and max_y. The curve is also reset with a call to reset().

gtk.Curve.get_vector

    def set_vector(size=-1)
size :the number of points to return or -1 to return all the points in the curve.
Returns :a tuple containing the points

The get_vector() method returns a tuple of points representing the curve. The number of points to return is specified by size; if size is -1 all the points in the curve are returned.

gtk.Curve.set_vector

    def get_vector(vector)
vector :a list or tuple containing the points of the curve

The set_vector() method sets the curve using the points in vector. The curve type is set to gtk.CURVE_TYPE_FREE.

gtk.Curve.set_curve_type

    def set_curve_type(type)
type :the new curve type: gtk.CURVE_TYPE_LINEAR, gtk.CURVE_TYPE_SPLINE or gtk.CURVE_TYPE_FREE

The set_curve_type() method sets the "curve-type" property with the value of type. The curve type must be one of gtk.CURVE_TYPE_LINEAR, gtk.CURVE_TYPE_SPLINE or gtk.CURVE_TYPE_FREE. The curve will remain unchanged except when changing from a free curve to a linear or spline curve, in which case the curve will be changed as little as possible.

Signals

The "curve-type-changed" gtk.Curve Signal

    def callback(curve, user_param1, ...)
curve :the curve that received the signal
user_param1 :the first user parameter (if any) specified with the connect() method
... :additional user parameters (if any)

The "curve-type-changed" signal is emitted when the curve type has been changed. The curve type can be changed explicitly with a call to set_curve_type(). It is also changed as a side-effect of calling reset() or set_gamma()