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:
log_level: (debug, info, warning, error, critical)

Set the minimum log level to use

log_dir: string

Path of log directory

log_name: string

Format string to use for the filename of log file

log_enable: (0, 1)

Activate file logging

keyboard_mode: (‘’, ‘system’, ‘dock’, ‘multi’)

Keyboard mode to use. If empty, Kivy will decide for you what is the best for your current platform. Otherwise, you can set one of ‘system’ (real keyboard), ‘dock’ (one virtual keyboard docked in a screen side), ‘multi’ (one virtual keyboard everytime a widget ask for.)

keyboard_layout: string

Identifier of the layout to use

postproc:
double_tap_time: int

Time allowed for the detection of double tap, in milliseconds

double_tap_distance: float

Maximum distance allowed for a double tap, normalized inside the range 0 - 1000

retain_time: int

Time allowed for a retain touch, in milliseconds

retain_distance: int

If the touch moves more than is indicated by retain_distance, it will not be retained. Argument should be an int between 0 and 1000.

jitter_distance: int

Maximum distance for jitter detection, normalized inside the range 0 - 1000

jitter_ignore_devices: string, seperated with comma

List of devices to ignore from jitter detection

ignore: list of tuples

List of regions where new touches are ignored. This configuration token can be used to resolve hotspot problems with DIY hardware. The format of the list must be:

ignore = [(xmin, ymin, xmax, ymax), ...]

All the values must be inside 0 - 1 range.

graphics:
maxfps: int, default to 60

Maximum FPS allowed.

fullscreen: (0, 1, fake, auto)

Activate fullscreen. If set to 1, a resolution of width times height pixels will be used. If set to auto, your current display’s resolution will be used instead. This is most likely what you want. If you want to place the window in another display, use fake and adjust width, height, top and left.

width: int

Width of the Window, not used if in auto fullscreen

height: int

Height of the Window, not used if in auto fullscreen

fbo: (hardware, software, force-hardware)

Select the FBO backend to use.

show_cursor: (0, 1)

Show the cursor on the screen

position: (auto, custom)

Position of the window on your display. If auto is used, you have no control of the initial position: top and left are ignored.

top: int

Top position of the Window

left: int

Left position of the Window

window_icon: string

Path of the window icon. Use this if you want to replace the default pygame icon.

rotation: (0, 90, 180, 270)

Rotation of the Window

resizable: (0, 1)

If 0, the window will have a fixed size. If 1, the window will be resizable.

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:
scroll_distance: int

Default value of scroll_distance property in Scrollview widget. Check the widget documentation for more information.

scroll_friction: float

Default value of scroll_friction property in Scrollview widget. Check the widget documentation for more information.

scroll_timeout: int

Default value of scroll_timeout property in Scrollview widget. Check the widget documentation for more information.

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

write()

Write the configuration to the latest file opened with read() method.

Return True if the write finished successfully.