Context instructions

The context instructions represent non graphics elements like:
  • Matrix manipulation
  • Color manipulation
  • Texture binding
class kivy.graphics.context_instructions.LineWidth(*args, **kwargs)

Bases: kivy.graphics.instructions.ContextInstruction

Instruction to set the line width of the drawing context

class kivy.graphics.context_instructions.Color(*args, **kwargs)

Bases: kivy.graphics.instructions.ContextInstruction

Instruction to set the color state for any vetices being drawn after it

class kivy.graphics.context_instructions.BindTexture(**kwargs)

Bases: kivy.graphics.instructions.ContextInstruction

BindTexture Graphic instruction. The BindTexture Instruction will bind a texture and enable GL_TEXTURE_2D for subsequent drawing.

Parameters :
texture: Texture

specifies the texture to bind to the given index

source

Set/get the source (filename) to load for texture.

class kivy.graphics.context_instructions.PushMatrix(*args, **kwargs)

Bases: kivy.graphics.instructions.ContextInstruction

PushMatrix on context’s matrix stack

class kivy.graphics.context_instructions.PopMatrix(*args, **kwargs)

Bases: kivy.graphics.instructions.ContextInstruction

Pop Matrix from context’s matrix stack onto model view

class kivy.graphics.context_instructions.Rotate(*args)

Bases: kivy.graphics.context_instructions.Transform

Rotate the coordinate space by applying a rotation transformation on the modelview matrix. You can set the properties of the instructions afterwards with e.g.:

rot.angle = 90
rot.axis = (0,0,1)
angle

Property for getting/settings the angle of the rotation

axis

Property for getting/settings the axis of the rotation

The format of the axis is (x, y, z).

set(float angle, float ax, float ay, float az)

Set the angle and axis of rotation

>>> rotationobject.set(90, 0, 0, 1)
class kivy.graphics.context_instructions.Scale(*args)

Bases: kivy.graphics.context_instructions.Transform

Instruction to perform a uniform scale transformation

scale

Property for getting/setting the scale.

The same scale value is applied on all axis.

class kivy.graphics.context_instructions.Translate(*args)

Bases: kivy.graphics.context_instructions.Transform

Instruction to create a translation of the model view coordinate space

set_translate(x, y, z)
x

Property for getting/setting the translation on X axis

xy

2 tuple with translation vector in 2D for x and y axis

xyz

3 tuple translation vector in 3D in x, y, and z axis

y

Property for getting/setting the translation on Y axis

z

Property for getting/setting the translation on Z axis

class kivy.graphics.context_instructions.MatrixInstruction(*args, **kwargs)

Bases: kivy.graphics.instructions.ContextInstruction

Base class for Matrix Instruction on canvas

matrix

Matrix property. Numpy matrix from transformation module setting the matrix using this porperty when a change is made is important, becasue it will notify the context about the update

kivy.graphics.context_instructions.gl_init_resources()

gl_init_resources()