📜  在 PySimpleGUI 中添加自定义颜色主题

📅  最后修改于: 2022-05-13 01:54:48.457000             🧑  作者: Mango

在 PySimpleGUI 中添加自定义颜色主题

PySimpleGUI 允许用户为其主题列表选择主题。此外,它允许用户根据自己的选择指定和自定义主题。用户只应该知道颜色阴影,即颜色的十六进制代码。因此,他/她可以通过新颜色自定义主题。

例子:

import PySimpleGUI as sg
  
# Add your new theme colors and settings
sg.LOOK_AND_FEEL_TABLE['MyCreatedTheme'] = {'BACKGROUND': '# 000066',
                                        'TEXT': '# FFCC66',
                                        'INPUT': '# 339966',
                                        'TEXT_INPUT': '# 000000',
                                        'SCROLL': '# 99CC99',
                                        'BUTTON': ('# 003333', '# FFCC66'),
                                        'PROGRESS': ('# D1826B', '# CC8019'),
                                        'BORDER': 1, 'SLIDER_DEPTH': 0, 
'PROGRESS_DEPTH': 0, }
  
# Switch to use your newly created theme
sg.theme('MyCreatedTheme')
  
# Call a popup to show what the theme looks like
sg.popup_get_text('This how the MyNewTheme is created')      

输出: