MCPcopy
hub / github.com/PySimpleGUI/PySimpleGUI / _theme_preview_window_swatches

Function _theme_preview_window_swatches

PySimpleGUI/PySimpleGUI.py:19995–20022  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19993
19994
19995def _theme_preview_window_swatches():
19996 # Begin the layout with a header
19997 layout = [[Text('Themes as color swatches', text_color='white', background_color='black', font='Default 25')],
19998 [Text('Tooltip and right click a color to get the value', text_color='white', background_color='black', font='Default 15')],
19999 [Text('Left click a color to copy to clipboard', text_color='white', background_color='black', font='Default 15')]]
20000 layout = [[Column(layout, element_justification='c', background_color='black')]]
20001 # Create the pain part, the rows of Text with color swatches
20002 for i, theme_name in enumerate(theme_list()):
20003 theme(theme_name)
20004 colors = [theme_background_color(), theme_text_color(), theme_input_background_color(),
20005 theme_input_text_color()]
20006 if theme_button_color() != COLOR_SYSTEM_DEFAULT:
20007 colors.append(theme_button_color()[0])
20008 colors.append(theme_button_color()[1])
20009 colors = list(set(colors)) # de-duplicate items
20010 row = [T(theme(), background_color='black', text_color='white', size=(20, 1), justification='r')]
20011 for color in colors:
20012 if color != COLOR_SYSTEM_DEFAULT:
20013 row.append(T(SYMBOL_SQUARE, text_color=color, background_color='black', pad=(0, 0), font='DEFAUlT 20', right_click_menu=['Nothing', [color]],
20014 tooltip=color, enable_events=True, key=(i, color)))
20015 layout += [row]
20016 # place layout inside of a Column so that it's scrollable
20017 layout = [[Column(layout, size=(500, 900), scrollable=True, vertical_scroll_only=True, background_color='black')]]
20018 # finish the layout by adding an exit button
20019 layout += [[B('Exit')]]
20020
20021 # create and return Window that uses the layout
20022 return Window('Theme Color Swatches', layout, background_color='black', finalize=True, keep_on_top=True)
20023
20024
20025def theme_previewer_swatches():

Callers 1

theme_previewer_swatchesFunction · 0.85

Calls 10

TextClass · 0.85
ColumnClass · 0.85
theme_listFunction · 0.85
themeFunction · 0.85
theme_background_colorFunction · 0.85
theme_text_colorFunction · 0.85
theme_input_text_colorFunction · 0.85
theme_button_colorFunction · 0.85
WindowClass · 0.85

Tested by

no test coverage detected