MCPcopy
hub / github.com/PySimpleGUI/PySimpleGUI / theme_previewer_swatches

Function theme_previewer_swatches

PySimpleGUI/PySimpleGUI.py:20025–20056  ·  view source on GitHub ↗

Display themes in a window as color swatches. Click on a color swatch to see the hex value printed on the console. If you hover over a color or right click it you'll also see the hext value.

()

Source from the content-addressed store, hash-verified

20023
20024
20025def theme_previewer_swatches():
20026 """
20027 Display themes in a window as color swatches.
20028 Click on a color swatch to see the hex value printed on the console.
20029 If you hover over a color or right click it you'll also see the hext value.
20030 """
20031 current_theme = theme()
20032 popup_quick_message('This is going to take a minute...', text_color='white', background_color='red', font='Default 20', keep_on_top=True)
20033 window = _theme_preview_window_swatches()
20034 theme(OFFICIAL_PYSIMPLEGUI_THEME)
20035 # col_height = window.get_screen_size()[1]-200
20036 # if window.size[1] > 100:
20037 # window.size = (window.size[0], col_height)
20038 # window.move(window.get_screen_size()[0] // 2 - window.size[0] // 2, 0)
20039
20040 while True: # Event Loop
20041 event, values = window.read()
20042 if event == WIN_CLOSED or event == 'Exit':
20043 break
20044 if isinstance(event, tuple): # someone clicked a swatch
20045 chosen_color = event[1]
20046 else:
20047 if event[0] == '#': # someone right clicked
20048 chosen_color = event
20049 else:
20050 chosen_color = ''
20051 print('Copied to clipboard color = ', chosen_color)
20052 clipboard_set(chosen_color)
20053 # window.TKroot.clipboard_clear()
20054 # window.TKroot.clipboard_append(chosen_color)
20055 window.close()
20056 theme(current_theme)
20057
20058
20059def change_look_and_feel(index, force=False):

Callers 1

mainFunction · 0.85

Calls 6

themeFunction · 0.85
popup_quick_messageFunction · 0.85
clipboard_setFunction · 0.85
readMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected