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

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

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 jittering detection, normalized inside the range 0 - 1000

jitter_ignore_devices: string, seperated with comma

List of devices to ignore from jittering 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, the fullscreen will use a resolution of width times height pixels. If set to auto, the fullscreen will use your current display’s resolution 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 about 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

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

Maximum distance to trigger the on_touch_down/on_touch_up on child for every List widget. The value is in pixels.

list_friction: int

Friction factor. 1 mean no friction.

list_friction_bound: int

If one side of the list have been hit by the user, you have the possibility to reduce the friction to use. Prefer a value below the list_friction token.

keyboard_type: (real, virtual)

Type of the keyboard to use. If set to real, no virtual keyboard will be shown on the screen. You will have to use your hardware keyboard to enter text.

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

Kivy configuration object

class kivy.config.KivyConfigParser

Bases: ConfigParser.ConfigParser

Enhanced ConfigParser class, that support the possibility of add default sections and default values.

adddefaultsection(section)

Add a section if the section is missing.

getdefault(section, option, defaultvalue)

Get an option. If not found, it will return the defaultvalue

setdefault(section, option, value)

Set the default value on a particular option

write()

Write the configuration to the default kivy file