
Kivy Cookbook
By :

Actually, Kivy has the parser package that helps in the CSS parsing. Even though it is not a complete parsing, it helps to parse instructions related to a framework. The recipe will show some that you could find useful in your context.
The parser package has eight classes, so we will work in Python to review all of them. Let's follow the next steps:
Import the parser
package.
from kivy.parser import *
Parse a color from a string.
parse_color('#090909')
Parse a string to a string.
parse_string("(a,1,2)")a
Parse a string to a boolean value.
parse_bool("0")
Parse a string to a list of two integers.
parse_int2("12 54")
Parse a string to a list of four floats.
parse_float4('54 87.13 35 0.9')
Parse a file name.
parse_filename('e7.py')
Finally, we have parse_int
and parse_float
, which are aliases of int and float, respectively.
In the second step, we parse any of the common ways to define a color (that is, RGB(r, g, b), RGBA(r, g, b, a), aaa, rrggbb, #aaa or #rrggbb...
Change the font size
Change margin width
Change background colour