python之PySimpleGUI(二)属性
作者:互联网
属性
Size
• Key 相当于句柄/ID
• Font
• Pad
• Colors
• Enable Events
• Visibility
• Tooltip
• Metadata
• Right click menu (tkinter) 右击
其他
设置配置项可以为jsony也可以是ini
ini时需要这样
settings = sg.UserSettings('my_config.ini', use_config_file=True, convert_bools_and_none=True)
获取值
settings['Section 2']['var']
settings['Section 2'].get('var', 'Default Value')
设置值
settings['Section 2']['var'] = 'New Value'
settings['Section 2'].set('var', 'New Value')
删除
del settings['My Section1']['test']
del settings['My Section1']['test']
settings['My Section1'].delete_section()
关闭的时候前用这条
settings['-filename-'] = values['-IN-']
11Finalize要求的原因是,在读取或最终确定窗口之前,不会实际创建并填充GUI小部件 非必须
12错误解决方法
ValueError: script '.......\src\tkinter' not found
Then try adding --hidden-import tkinter to your command
13Valid look and feel values are currently:有效外观值
ListOfLookAndFeelValues()获取最新配色方案
SystemDefault
Topanga
GreenTan
Dark
LightGreen
Dark2
Black
Tan
TanBlue
DarkTanBlue
DarkAmber
DarkBlue
Reds
Green
BluePurple
Purple
BlueMono
GreenMono
BrownBlue
BrightColors
NeutralBlue
Kayak
SandyBeach
TealMono
用法
SetOptions(background_color=colors['BACKGROUND'],
text_element_background_color=colors['BACKGROUND'],
element_background_color=colors['BACKGROUND'],
text_color=colors['TEXT'],
input_elements_background_color=colors['INPUT'],
button_color=colors['BUTTON'],
progress_meter_color=colors['PROGRESS'],
border_width=colors['BORDER'],
slider_border_width=colors['SLIDER_DEPTH'],
progress_meter_border_depth=colors['PROGRESS_DEPTH'],
scrollbar_color=(colors['SCROLL']),
element_text_color=colors['TEXT'],
input_text_color=colors['TEXT_INPUT'])
do_not_clear 表单可以自动清除
标签:settings,python,text,Section,PySimpleGUI,color,colors,background,属性 来源: https://www.cnblogs.com/catfeel/p/15756084.html