goocanvas.PathModel
Prev | PyGooCanvas Canvas Item Models Reference | Next

## goocanvas.PathModel

goocanvas.PathModel — A model for path items.

## Synopsis

    class goocanvas.PathModel(goocanvas.ItemModelModelSimple):
        goocanvas.PathModel(properties=None)

## Ancestry

    +-- gobject.GObject
    	+-- goocanvas.ItemModelModelSimple
    		+-- goocanvas.PathModel

## goocanvas.PathModel Properties

"data" | Write | The sequence of path commands, specified as a string using the same syntax as in the Scalable Vector Graphics (SVG) path element. Default value: NULL.

## Implemented Interfaces

`goocanvas.PathModel` implements `goocanvas.ItemModel`

## Description

`goocanvas.PathModel` represents a path item, which is a series of one or more lines, bezier curves, or elliptical arcs. It is a subclass of `goocanvas.ItemModelModelSimple` and so inherits all of the style properties such as "stroke-color", "fill-color" and "line-width". It also implements the `goocanvas.ItemModel` interface, so you can use the `goocanvas.ItemModel` functions such as `goocanvas.ItemModel.raise_()` and `goocanvas.ItemModel.rotate()``goocanvas.PathModel` uses the same path specification strings as the Scalable Vector Graphics (SVG) path element. For details see the SVG Specification

## Constructor

        goocanvas.PathModel(properties=None)

`properties`: | A comma separated list of properties.
Returns: | A new `goocanvas.PathModel`

Creates a new canvas path model item.

Here's an example showing how to create a red line from (20,20) to (40,40):

    	path = goocanvas.PathModel(data="M 20 20 L 40 40", stroke_color="red")

This example creates a cubic bezier curve from (20,100) to (100,100) with the control points at (20,50) and (100,50):

    	path = goocanvas.PathModel(data="M20,100 C20,50 100,50 100,100", stroke_color="blue")

This example uses an elliptical arc to create a filled circle with one quarter missing:

    	path = goocanvas.PathModel(data="M200,500 h-150 a150,150 0 1,0 150,-150 z", fill_color="red", stroke_color="blue", line_width=5.0,)

Prev | Up | Next
goocanvas.ImageModel | Home | goocanvas.PolylineModel