Vertex Instructions

This module include all the classes for drawing simple vertex object.

class kivy.graphics.vertex_instructions.Triangle(**kwargs)

Bases: kivy.graphics.instructions.VertexInstruction

A 2d triangle.

Parameters :
points: list

List of point in the format (x1, y1, x2, y2, x3, y3)

points

Property for getting/settings points of the triangle

class kivy.graphics.vertex_instructions.Quad(**kwargs)

Bases: kivy.graphics.instructions.VertexInstruction

A 2d quad.

Parameters :
points: list

List of point in the format (x1, y1, x2, y2, x3, y3, x4, y4)

points

Property for getting/settings points of the quads

class kivy.graphics.vertex_instructions.Rectangle(**kwargs)

Bases: kivy.graphics.instructions.VertexInstruction

A 2d rectangle.

Parameters :
pos: list

Position of the rectangle, in the format (x, y)

size: list

Size of the rectangle, in the format (width, height)

pos

Property for getting/settings the position of the rectangle

size

Property for getting/settings the size of the rectangle

class kivy.graphics.vertex_instructions.BorderImage(**kwargs)

Bases: kivy.graphics.vertex_instructions.Rectangle

A 2d border image. The behavior of the border image is similar to the concept of CSS3 border-image.

Parameters :
border: list

Border information in the format (top, right, bottom, left). Each value is in pixels.

border

Property for getting/setting the border of the class

class kivy.graphics.vertex_instructions.Ellipse(*args, **kwargs)

Bases: kivy.graphics.vertex_instructions.Rectangle

A 2d ellipse.

Parameters :
segments: int, default to 180

Define how much segment is needed for drawing the ellipse. The drawing will be smoother if you have lot of segment.

segments

Property for getting/setting the number of segments of the ellipse

class kivy.graphics.vertex_instructions.Line(**kwargs)

Bases: kivy.graphics.instructions.VertexInstruction

A 2d line.

Parameters :
points: list

List of points in the format (x1, y1, x2, y2...)

points

Property for getting/settings points of the triangle

Warning

This will always reconstruct the whole graphics from the new points list. It can be very CPU expensive.

class kivy.graphics.vertex_instructions.Point(**kwargs)

Bases: kivy.graphics.instructions.VertexInstruction

A 2d line.

Parameters :
points: list

List of points in the format (x1, y1, x2, y2...)

pointsize: float, default to 1.

Size of the point (1. mean the real size will be 2)

add_point(float x, float y)

Add a point into the current points list.

If you intend to add multiple point, prefer to use this method, instead of reassign a new points list. Assigning a new points list will recalculate and reupload the whole buffer into GPU. If you use add_point, it will only upload the changes.
points

Property for getting/settings points of the triangle

pointsize

Property for getting/setting point size