goocanvas.Path — A Path item.
"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. "height" Read/Write The height of the path. Allowed values: >= 0. Default value: 0. "width" Read/Write The width of the path. Allowed values: >= 0. Default value: 0. "x" Read/Write The x coordinate of the path. Default value: 0. "y" Read/Write The y coordinate of the path. Default value: 0.
goocanvas.Path
represents a path item, which is a series of one or more lines, bezier curves, or elliptical arcs.
It is a subclass of
goocanvas.ItemSimple
and so inherits all of the style properties such as "stroke-color", "fill-color" and "line-width".
It also implements the goocanvas.Item
interface, so you can use the goocanvas.Item
functions such as goocanvas.Item.raise_()
and goocanvas.Item.rotate()
goocanvas.Path uses the same path specification strings
as the Scalable Vector Graphics (SVG) path element. For details see the
SVG Specification
To respond to events such as mouse clicks on the path you must connect to the signal handlers of the corresponding
goocanvas.PathView object.
(See goocanvas.CanvasView.get_item_view()
and goocanvas.CanvasView signal
"item-view-created")
goocanvas.Path(properties= None);
| A comma separated list of properties. |
Returns : | A new
goocanvas.Path
|
Creates a new canvas path item.
Here's an example showing how to create a red line from (20,20) to (40,40):
path = goocanvas.Path(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.Path(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.Path(data="M200,500 h-150 a150,150 0 1,0 150,-150 z", fill_color="red", stroke_color="blue", line_width=5.0,)