I am building a kivy app and I want to add a settings screen that allows the users to change the font size of the entire application (that is, all the text in buttons and labels). I can’t find a way to do it unless I manually go over all the buttons and labels and change them one by one. is there a sane way of doing this?
Advertisement
Answer
You can create one or more NumericProperty
in the App
class. Then, in your kv
you can assign the font_size
as:
font_size: app.default_font_size
where default_font_size
is the NumericProperty
. Note that the loading of such a kv
will need to be done after the App
is created (because of the app
keyword use). A good choice is within the build()
method of the App
.
Then any change to the default_font_size
will be reflected in your GUI.