PREFS
v1.0.1
容易存储和管理首选项。

PERFS是Python库,它将偏好存储在带有字典结构的文本文件中。
在Windows上:
pip install PREFS
在MacOS和Linux上:
pip3 install PREFS
要初始化您的首选项,您需要将第一个参数的Prefs类实例为默认偏好(第一次运行时使用或每当文件删除文件时使用的偏好)。
import prefs
default_prefs = {
"lang" : "en" ,
"theme" : {
"background" : "#ffffff" ,
"font" : "UbuntuMono" ,
},
}
my_prefs = prefs . Prefs ( default_prefs )以上代码将创建一个称为prefs.prefs的文件,该文件看起来像:
#PREFS
lang = 'en'
theme = >
background = '#ffffff'
font = 'UbuntuMono'然后,您可以更改值,就像是字典一样。
my_prefs [ "lang" ] = "es"现在prefs.prefs看起来像:
#PREFS
lang = 'es'
theme = >
background = '#ffffff'
font = 'UbuntuMono'您也可以手动编写自己的prefs文件,以管理应用程序的配色方案或翻译。
与我联系:
V1.0.0