This package assemble all low level function to draw object. The whole graphics package is compatible OpenGL ES 2.0, and have a lot of rendering optimizations.
For drawing on a screen, you will need :
- a Canvas object.
- Instruction objects.
Each widget in Kivy already have by default their Canvas. When you are creating a widget, you can create all the instructions needed for drawing. If self is your current widget, you can do:
from kivy.graphics import *
with self.canvas:
# Add a red color
Color(1., 0, 0)
# Add a rectangle
Rectangle(pos=(10, 10), size=(500, 500))
The instructions Color and Rectangle are automaticly added to the canvas object, and will be used when the window drawing will happen.
Todo
Write more about the compilation.