Code Input

New in version 1.5.0.

_images/codeinput.jpg

The CodeInput provides a box of editable highlited text, like the ones shown in the image.

It supports all the features supported by the textinput and Code highliting for languages supported by pygments along with KivyLexer for KV Language highliting.

Usage example

To create a CodeInput with highliting for KV language:

from kivy.uix.codeinput import CodeInput
from kivy.extras.highlight import KivyLexer
codeinput = CodeInput(lexer=KivyLexer())

To create a CodeInput with highliting for Cython:

from kivy.uix.codeinput import CodeInput
from pygments.lexers import CythonLexer
codeinput = CodeInput(lexer=CythonLexer())
class kivy.uix.codeinput.CodeInput(**kwargs)

Bases: kivy.uix.textinput.TextInput

CodeInput class, used for displaying highlighted code.

lexer

This holds the selected Lexer used by pygments to highlight the code

lexer is a ObjectProperty defaults to PythonLexer