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

## goocanvas.GridModel

goocanvas.GridModel — A model for grid items.

## Synopsis

    class goocanvas.GridModel(goocanvas.ItemModelSimple):
        goocanvas.GridModel(properties=None)

## Ancestry

    +-- gobject.GObject
    	+-- goocanvas.ItemModelSimple
    		+-- goocanvas.GridModel

## goocanvas.GridModel Properties

"border_color" | Write | The color to use for the border. Default value: `None`.
"border-color-rgba" | Read/Write | The color to use for the border, specified as a 32-bit integer value. Default value: 0.
"border-pattern" | Read/Write | The cairo pattern to paint the border with.
"border-pixbuf" | Write | The pixbuf to use to draw the border.
"border-width" | Read/Write | The width of the border around the grid. Default value: -1.
"height" | Read/Write | The height of the grid. Allowed values: >= 0. Default value: 0.
"horz-grid-line-color" | Write | The color to use for the horizontal grid lines. Default value: `None`.
"horz-grid-line-color-rgba" | Read/Write | The color to use for the horizontal grid lines, specified as a 32-bit integer value. Default value: 0.
"horz-grid-line-pattern" | Read/Write | The cairo pattern to paint the horizontal grid lines with.
"horz-grid-line-pixbuf" | Write | The pixbuf to use to draw the horizontal grid lines.
"horz-grid-line-width" | Read/Write | The width of the horizontal grid lines. Default value: -1.
"vert-grid-line-color" | Write | The color to use for the vertical grid lines. Default value: `None`.
"vert-grid-line-color-rgba" | Read/Write | The color to use for the vertical grid lines, specified as a 32-bit integer value. Default value: 0.
"vert-grid-line-pattern" | Read/Write | The cairo pattern to paint the vertical grid lines with.
"vert-grid-line-pixbuf" | Write | The pixbuf to use to draw the vertical grid lines.
"vert-grid-line-width" | Read/Write | The width of the vertical grid lines. Default value: -1.
"width" | Read/Write | The width of the grid. Allowed values: >= 0. Default value: 0.
"x" | Read/Write | The x coordinate of the grid. Default value: 0.
"x-offset" | Read/Write | The distance before the first vertical grid line. Allowed values: >= 0. Default value: 0.
"x-step" | Read/Write | The distance between the vertical grid lines. Allowed values: >= 0. Default value: 10.
"y" | Read/Write | The y coordinate of the grid. Default value: 0.
"y-offset" | Read/Write | The distance before the first horizontal grid line. Allowed values: >= 0. Default value: 0.
"y-step" | Read/Write | The distance between the horizontal grid lines. Allowed values: >= 0. Default value: 10.

## Implemented Interfaces

`goocanvas.GridModel` implements `goocanvas.ItemModel`

## Description

`goocanvas.GridModel` represents a model for grid items. It is a subclass of `goocanvas.ItemModelSimple` 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()`. To respond to events such as mouse clicks on the ellipse you must connect to the signal handlers of the corresponding `goocanvas.Grid` objects. (See `get_item` and GooCanvas::item-created.)

## Constructor

        goocanvas.GridModel(properties=None)

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

Creates a new canvas grid model.

Here's an example showing how to create a grid model:

    grid = goocanvas.GridModel(parent=root,
                                x=100,
                                y=100,
                                width=400,
                                height=200,
                                x_step=20,
                                Y_step=20,
                                x_offset=10,
                                y_offset=10,
                                horz_grid_line_width=4.0,
                                horz_grid_line_color="yellow",
                                vert_grid_line_width=2.0,
                                vert_grid_line_color="red",
                                border_width=3.0,
                                border_color="white",
                                fill_color="blue"
                                )

Prev | Up | Next
goocanvas.EllipseModel | Home | goocanvas.GroupModel