The Framebuffer represents a helpful tool for the graphical content of Kivy. It is an offscreen tool where we can draw any complex set of instructions. We render this offscreen tool and use it on the canvas as a whole.
You need to have cleared the recipes in Chapter 5, Graphics – Canvas and Instructions, to understand this recipe because you need to be able to differentiate between the Framebuffer and the canvas.
To complete this recipe, we will use just one Python file that has four rectangles with a texture that we are going to create in the Framebuffer. Follow these steps:
In the Python file, import the usual Kivy packages.
Also import the
Fbo
package.Define the
MyW
class.Define the
__init()__
method for the class.Provide
canvas
in the method.Create the
fbo
context.Define four rectangles using the
fbo
texture.Define the
fbo
context.Then, define two rectangles of different colors:
import kivy kivy.require('1.9.0') # Code tested in this version...