PySimpleGUI/DemoPrograms/Demo_Theme_Add_Your_Own.py

40 lines
9.1 KiB
Python
Raw Permalink Normal View History

import PySimpleGUI as sg
"""
Demo showing how to add your own theme.
There are functions to make the job quick and easy.
Copyright 2021 PySimpleGUI.org
"""
# First make a dictionary with the required keys.
# Use only colors in the format of #RRGGBB
DarkGrey20 = {'BACKGROUND': '#19232D',
'TEXT': '#ffffff',
'INPUT': '#32414B',
'TEXT_INPUT': '#ffffff',
'SCROLL': '#505F69',
'BUTTON': ('#ffffff', '#32414B'),
'PROGRESS': ('#505F69', '#32414B'),
'BORDER': 1, 'SLIDER_DEPTH': 0, 'PROGRESS_DEPTH': 0,
}
# Add your dictionary to the PySimpleGUI themes
sg.theme_add_new('DarkGrey20', DarkGrey20)
# Switch your theme to use the newly added one
sg.theme('Dark Grey 20')
def main():
# Test it out!
try:
sg.popup_get_text('Dark Grey 20 looks like this.', image=sg.EMOJI_BASE64_HAPPY_THUMBS_UP)
except:
sg.popup_get_text('Dark Grey 20 looks like this.\n' + \
'Upgrading to 4.35.0+ will give you a nice emoji like the one above',
image=EMOJI_BASE64_HAPPY_THUMBS_UP)
if __name__ == '__main__':
EMOJI_BASE64_HAPPY_THUMBS_UP = b'iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAYAAACohjseAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIy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