Version

Quick search

Table Of Contents

Context management

New in version 1.2.0.

This class manages a registry of all created graphics instructions. It has the ability to flush and delete them.

You can read more about Kivy graphics contexts in the Graphics module documentation. These are based on OpenGL graphics contexts.

class kivy.graphics.context.Context

Bases: builtins.object

The Context class manages groups of graphics instructions. It can also be used to manage observer callbacks. See add_reload_observer() and remove_reload_observer() for more information.

add_reload_observer()

(internal) Add a callback to be called after the whole graphics context has been reloaded. This is where you can reupload your custom data into the GPU.

Parameters
callback: func(context) -> return None

The first parameter will be the context itself

before: boolean, defaults to False

If True, the callback will be executed before all the reloading processes. Use it if you want to clear your cache for example.

Changed in version 1.4.0: before parameter added.

remove_reload_observer()

(internal) Remove a callback from the observer list previously added by add_reload_observer().