Configuration object¶
Config object is an instance of a modified Python ConfigParser. See ConfigParser documentation for more information.
Usage of Config object¶
Read a configuration token from a particular section:
>>> from kivy.config import Config
>>> Config.getint('kivy', 'show_fps')
0
Change the configuration and save it:
>>> Config.set('kivy', 'retain_time', 50)
>>> Config.write()
Available configuration tokens¶
Changed in version 1.0.8.
Changed in version 1.1.0.
Changed in version 1.2.0.
kivy: |
|
---|---|
postproc: |
|
graphics: |
|
input: | Input section is particular. You can create new input device with this syntax: # example of input provider instance
yourid = providerid,parameters
# example for tuio provider
default = tuio,127.0.0.1:3333
mytable = tuio,192.168.0.1:3334
See also Check all the providers in kivy.input.providers for the syntax to use inside the configuration file. |
widgets: |
|
modules: | You can activate modules with this syntax: modulename =
Anything after the = will be passed to the module as arguments. Check the specific module’s documentation for a list of accepted arguments. |
- kivy.config.Config = None¶
Kivy configuration object
- class kivy.config.ConfigParser¶
Bases: ConfigParser.ConfigParser
Enhanced ConfigParser class, that supports addition of default sections and default values.
New in version 1.0.7.
- adddefaultsection(section)¶
Add a section if the section is missing.
- getdefault(section, option, defaultvalue)¶
Get an option. If not found, it will return the default value
- read(filename)¶
Read only one filename. In contrast to the original ConfigParser of Python, this one is able to read only one file at a time. The latest read file will be used for the write() method.
- setdefault(section, option, value)¶
Set the default value of a particular option
- setdefaults(section, keyvalues)¶
Set a lot of keys/values in one section at the same time