Kv Compiler Runtime Functions

Exports functions used by the compiled code at runtime.

kivy.lang.compiler.runtime.clear_kvc_cache()[source]

Clears the cache that stores all the compiled functions that has been imported.

kivy.lang.compiler.runtime.get_kvc_filename(func, flags='')[source]

Returns the kvc file associated with the function. Specifically, it’s the filename where the function’s compiled kv code is stored.

The file may not exist, if it has not been compiled yet.

kivy.lang.compiler.runtime.load_kvc_from_file(func, target_func_name=None, flags='', compile_flags=())[source]

Loads the compiled kv function from the kvc file associated with the function.

This is a internal function, with non-public API.

Parameters:
  • func – The original function, whose compiled code should be loaded.
  • target_func_name – The name of the function as stored in the kvc file. Typically, it’s the function’s name.
  • flags – Any arch flags used when saving the kvc file. This is stored in the kvc filename.
  • compile_flags – Any compiler flags used when compiling the kvc file. These are stored within the compiled code, not in the filename.
Returns:

The compiled function object.

kivy.lang.compiler.runtime.save_kvc_to_file(func, src_code, flags='', compile_flags=())[source]

Saves the compiled source code generated from the function to a kvc file.

This is a internal function, with non-public API.

Parameters:
  • func – The function object from which the compiled code was generated.
  • src_code – The compiled source code as string.
  • flags – Any arch flags used when saving the kvc file. This is stored in the kvc filename.
  • compile_flags – Any compiler flags used when compiling the kvc file. These are stored within the compiled code, not in the filename.
kivy.lang.compiler.runtime.add_graphics_callback(item, largs)[source]

Add the item to be added to the linked list of canvas instructions to be executed with all the canvas instructions by process_graphics_callbacks(). If it’s already scheduled, it is not added again.

This is a internal function, with non-public API.

Parameters:
  • item – The item scheduled.
  • largs – The largs of the first time the callback was scheduled. It gets forwarded to the callback when executed.
kivy.lang.compiler.runtime.process_graphics_callbacks()[source]

Process all the canvas callbacks that has been scheduled by add_graphics_callback().

This is a internal function, with non-public API.