Quick search

Table Of Contents

Code Input

New in version 1.5.0.

_images/codeinput.jpg

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

It supports all the features provided by the textinput as well as code highliting for languages supported by pygments along with KivyLexer for kivy.lang 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)[source]

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 an ObjectProperty and defaults to PythonLexer.