From 8b2dbc86727f24bb32d6f339751cc6eac9a60d67 Mon Sep 17 00:00:00 2001 From: PySimpleGUI Date: Thu, 14 Nov 2019 12:54:34 -0500 Subject: [PATCH 1/2] New preview_all_look_and_feel_themes() - shows a window with the different themes and their names --- PySimpleGUI.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index bc74169b..eb9c8b8a 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -10078,6 +10078,31 @@ def ChangeLookAndFeel(index, force=False): print('valid values are', list_of_look_and_feel_values()) +def preview_all_look_and_feel_themes(): + web=False + + WINDOW_BACKGROUND = 'lightblue' + + def sample_layout(): + return [[Text('Text element'), InputText('Input data here', size=(15, 1))], + [Button('Ok'), Button('Cancel'), Slider((1, 10), orientation='h', size=(10, 15))]] + + layout = [[Text('Here is a complete list of themes', font='Default 18', background_color=WINDOW_BACKGROUND)]] + + row = [] + for count, theme in enumerate(ListOfLookAndFeelValues()): + change_look_and_feel(theme) + if not count % 3: + layout += [row] + row = [] + row += [Frame(theme, sample_layout() if not web else [[T(theme)]] + sample_layout())] + if row: + layout += [row] + + window = Window('Preview of all Look and Feel choices', layout, background_color=WINDOW_BACKGROUND) + window.read() + window.close() + del window # Converts an object's contents into a nice printable string. Great for dumping debug data From 27a1da42611111169c98bc3f293c0ecc5d700947 Mon Sep 17 00:00:00 2001 From: PySimpleGUI Date: Thu, 14 Nov 2019 12:55:37 -0500 Subject: [PATCH 2/2] New Demo that shows all of the look and feel choices. Runs on all ports (except Wx) --- DemoPrograms/Demo_LookAndFeel_Previewer.py | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 DemoPrograms/Demo_LookAndFeel_Previewer.py diff --git a/DemoPrograms/Demo_LookAndFeel_Previewer.py b/DemoPrograms/Demo_LookAndFeel_Previewer.py new file mode 100644 index 00000000..efb250a0 --- /dev/null +++ b/DemoPrograms/Demo_LookAndFeel_Previewer.py @@ -0,0 +1,23 @@ +import PySimpleGUI as sg; web=False +# import PySimpleGUIWeb as sg; web=True +# import PySimpleGUIQT as sg; web=False + +WINDOW_BACKGROUND = 'lightblue' + +def sample_layout(): + return [[sg.Text('Text element'), sg.InputText('Input data here', size=(15,1))], + [sg.Button('Ok'), sg.Button('Cancel'), sg.Slider((1,10), orientation='h', size=(10,15)) ]] + +layout = [[sg.Text('Here is a complete list of themes', font='Default 18', background_color=WINDOW_BACKGROUND)]] + +row = [] +for count, theme in enumerate(sg.ListOfLookAndFeelValues()): + sg.change_look_and_feel(theme) + if not count % 3: + layout += [row] + row = [] + row += [sg.Frame(theme, sample_layout() if not web else [[sg.T(theme)]]+sample_layout())] +if row: + layout += [row] + +sg.Window('Preview of all Look and Feel choices', layout, background_color=WINDOW_BACKGROUND).read()