from kivy.config import Config
Config.getint('kivy', 'desktop')
from kivy.config import Config
Config.set('graphics', 'resizable', True)
方法 | 说明 |
---|
add_callback(callback,section = None,key = None ) | 添加在节点或键已更改时要调用的回调 |
adddefaultsection(section) | 添加一个节点 |
get(section,option,** kwargs) | 获取节点的选项值 |
getdefault(section,option,defaultvalue) | 获取节点中的选项的值 |
getdefaultint(section,option,defaultvalue) | 获取节点中的选项的值 |
name | 与此ConfigParser实例关联的名称 |
read(filename) | 读取文件 |
remove_callback(callback,section=None,key = None) | 删除添加的回调 |
set(section,option,value ) | 配置,对所有的程序都会生效 |
setall(section,{key:value}) | 在节点中设置键值对 |
setdefault(section,option,value) | 在节点中设置选项的默认值 |
setdefaults(section,{key:value}) | 在节点中设置多个键值默认值 |
update_config(filename,overwrite=False) | 根据新的默认配置文件升级配置 |
write() | 将配置写入使用该read()方法打开的最后一个文件 |
section="kivy"的可选配置
options | 说明 |
---|
desktop: int | 是否启动特定功能。0 or 1 |
exit_on_escape: int | 启用esc键退出。0 or 1 |
pause_on_minimize: | 最小化停止运行(台式)。0 or 1 |
keyboard_layout: string | 键盘布局 |
keyboard_mode: | 键盘模式。‘’最佳,‘system ’真实,‘dock ’模拟,‘multi ’ 多重,‘systemanddock ’混合,‘systemandmulti ’ 复合 |
log_dir: string | 日志目录路径 |
log_enable: int | 激活文件记录。0 or 1 |
log_level: string | 最低日志级别。‘trace ’, ‘debug ’, ‘info ’, ‘warning ’, ‘error ’ or ‘critical ’ |
log_name: string | 日志文件的文件名 |
log_maxfiles: int | 最大日志文件数int+1个,-1为清空 |
window_icon: string | 窗口图标的路径 |
section="postproc"的可选配置
options | 说明 |
---|
double_tap_distance: | 双击允许的最大距离,0 - 1000之间 |
double_tap_time: int | 检测双击的时间(毫秒) |
ignore: list of tuples | 忽略新触摸的区域列表。格式为:ignore = [(xmin, ymin, xmax, ymax), ...] ,0 - 1之间 |
jitter_distance: int | 抖动检测的最大距离,0 - 1000之间 |
jitter_ignore_devices: string,… | 抖动检测中要忽略的设备列表。 |
retain_distance: int | 保持触摸的移动幅度,0 - 1000之间 |
retain_time: int | 保持触摸所需的时间(毫秒) |
triple_tap_distance: | 三连击允许的最大距离,0 - 1000之间 |
triple_tap_time: int | 检测三次敲击所允许的时间(毫秒) |
section="graphics"的可选配置
options | 说明 |
---|
borderless: int | 无边框。0 or 1。如果为1,必须同时禁用窗口大小可调整 |
window_state: | 设置窗口状态(台式),‘visible ’可见(默认), ‘hidden ’隐藏, ‘maximized ’ 最大化, ‘minimized ’最小化 |
fbo: string | 选择使用的FBO后端。‘hardware ’, ‘software ’ or ‘force-hardware ’ |
fullscreen: | 激活全屏。0 or 1, ‘fake ’ or ‘auto ’ |
height: int | 窗口高度高度。如果fullscreen 为auto 则无效 |
left: int | 窗口左侧位置。如果position 为auto 则无效. |
maxfps: int | 允许的最大FPS。默认60(设置为0将导致CPU满负荷) |
‘multisamples’: int | 设置多重采样抗锯齿(MSAA)级别。默认为2。增加数值使图形更平滑,但更加耗时且对不支持请求的MSAA级别的设备无效 |
position: string | 窗口在显示器上的位置。‘auto’ or ‘custom’ |
show_cursor: int | 设置是否显示光标。0 or 1 |
top: int | 窗口顶部位置。如果position 为auto 则无效. |
resizable: int | 窗口大小可调整。0 or 1 |
rotation: int | 窗口旋转角度。0, 90, 180 or 270 |
width: int | 窗口宽度。如果fullscreen 为auto 则无效 |
minimum_width: int | 窗口限制的最小宽度。(仅限sdl2) |
minimum_height: int | 窗口限制的最小高度。(仅限sdl2) |
min_state_time: float | 最短视觉状态的时间。默认为.035 |
kivy_clock: | 时钟类型。default , interrupt , free_all , free_only |
default_font: list | 默认的字体。默认为[‘Roboto’, ‘data/fonts/Roboto-Regular.ttf’, ‘data/fonts/Roboto-Italic.ttf’, ‘data/fonts/Roboto-Bold.ttf’, ‘data/fonts/Roboto-BoldItalic.ttf’] |
allow_screensaver: | 允许屏保或睡眠(限sdl2)。0 or 1(默认) |
section="widgets"的可选配置
options | 说明 |
---|
scroll_distance: int | 最短滚动距离(像素) |
scroll_timeout: int | 最大时间段(毫秒) |