Version

Quick search

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

observer callbacks. See add_reload_observer() and remove_reload_observer() for more information.

add_reload_observer(self, callback, before=False)

(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.

flag_update_canvas(self)
flush(self) void
gl_dealloc(self, *largs)
reload(self)
remove_reload_observer(self, callback, before=False)

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

trigger_gl_dealloc(self)