Quick search

Table Of Contents

Parser utilities

Helper functions used for CSS

kivy.parser.parse_color(text)

Parse a string to a kivy color. Supported formats : * rgb(r, g, b) * rgba(r, g, b, a) * aaa * rrggbb * #aaa * #rrggbb

kivy.parser.parse_int

alias of int

kivy.parser.parse_float

alias of float

kivy.parser.parse_string(text)

Parse a string to a string (remove single and double quotes)

kivy.parser.parse_bool(text)

Parse a string to a boolean, ignoring case. “true”/”1” is True, “false”/”0” is False. Anything else throws an exception.

kivy.parser.parse_int2(text)

Parse a string to a list of exactly 2 integers

>>> print parse_int2("12 54")
12, 54
kivy.parser.parse_float4(text)

Parse a string to a list of exactly 4 floats

>>> parse_float4('54 87. 35 0')
54, 87., 35, 0
kivy.parser.parse_filename(filename)

Parse a filename and search for it using resource_find(). If found, the resource path is returned, otherwise return the unmodified filename (as specified by the caller).