From 27be46ecabe9d5cb37fc21715ae27aa6a825ccf5 Mon Sep 17 00:00:00 2001 From: PySimpleGUI Date: Tue, 11 Aug 2020 09:12:51 -0400 Subject: [PATCH 1/3] Set button background colors correctly so they blend with theme. --- DemoPrograms/Demo_Buttons_Mac.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/DemoPrograms/Demo_Buttons_Mac.py b/DemoPrograms/Demo_Buttons_Mac.py index 27e18b6b..1ec4154e 100644 --- a/DemoPrograms/Demo_Buttons_Mac.py +++ b/DemoPrograms/Demo_Buttons_Mac.py @@ -8,12 +8,12 @@ def show_win(): sg.set_options(border_width=0, margins=(0, 0), element_padding=(5, 3)) frame_layout = [ - [sg.Button('', image_data=mac_red, - button_color=('white', sg.COLOR_SYSTEM_DEFAULT), key='-exit-'), + [sg.Button(image_data=mac_red, + button_color=(sg.theme_background_color(),sg.theme_background_color()), key='-exit-'), sg.Button('', image_data=mac_orange, - button_color=('white', sg.COLOR_SYSTEM_DEFAULT)), + button_color=(sg.theme_background_color(),sg.theme_background_color())), sg.Button('', image_data=mac_green, - button_color=('white', sg.COLOR_SYSTEM_DEFAULT), key='-minimize-'), + button_color=(sg.theme_background_color(),sg.theme_background_color()), key='-minimize-'), sg.Text(' '*40)], ] layout = [[sg.Frame('', frame_layout)], From 023d41eccfed50f551d915e7f269e2afe3b8cb46 Mon Sep 17 00:00:00 2001 From: PySimpleGUI Date: Wed, 12 Aug 2020 07:51:27 -0400 Subject: [PATCH 2/3] Added X symbol and the Dark Grey 8 theme --- PySimpleGUI.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index d43f36f1..56b36a28 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1,5 +1,5 @@ #!/usr/bin/python3 -version = __version__ = "4.28.0.3 Unreleased 3-Aug-2020\nAdded a referesh to visiblity_changed (an existing function but blank), added Column.contents_changed which will update the scrollbar so corrently match the contents, separators expand only in 1 direction now, added SYBOOLS for arrows circle square" +version = __version__ = "4.28.0.4 Unreleased 3-Aug-2020\nAdded a referesh to visiblity_changed (an existing function but blank), added Column.contents_changed which will update the scrollbar so corrently match the contents, separators expand only in 1 direction now, added SYBOOLS for arrows circle square, dark gray 8 theme" port = 'PySimpleGUI' @@ -422,7 +422,8 @@ SYMBOL_CIRCLE_OUTLINE = '◯' SYMBOL_UP = '▲' SYMBOL_RIGHT = '►' SYMBOL_DOWN = '▼' -SYMBOL_LEFT = '◄' +SYMBOL_DOWN = '▼' +SYMBOL_X = '❎' # ====================================================================== # @@ -3186,6 +3187,7 @@ class Button(Element): if file_name: strvar.set(file_name) self.TKStringVar.set(file_name) + popup('called from saveas filename') elif self.BType == BUTTON_TYPE_CLOSES_WIN: # this is a return type button so GET RESULTS and destroy window # first, get the results table built # modify the Results table in the parent FlexForm object @@ -14424,6 +14426,15 @@ LOOK_AND_FEEL_TABLE = {'SystemDefault': 'BUTTON': ('red', 'yellow'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, 'PROGRESS_DEPTH': 0, }, + 'DarkGrey8': {'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, + } } From 091b42fcd8ff962358027dc12024b96c9be6990c Mon Sep 17 00:00:00 2001 From: PySimpleGUI Date: Wed, 12 Aug 2020 07:57:24 -0400 Subject: [PATCH 3/3] New demo showing a custom titlebar, uses new dark grey 9 theme --- .../Demo_Titlebar_Custom_Dark_Theme.py | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 DemoPrograms/Demo_Titlebar_Custom_Dark_Theme.py diff --git a/DemoPrograms/Demo_Titlebar_Custom_Dark_Theme.py b/DemoPrograms/Demo_Titlebar_Custom_Dark_Theme.py new file mode 100644 index 00000000..9d966ac5 --- /dev/null +++ b/DemoPrograms/Demo_Titlebar_Custom_Dark_Theme.py @@ -0,0 +1,55 @@ +import PySimpleGUI as sg + +""" + Demo showing how to remove the titlebar and replace with your own + Note that you cannot minimize these kinds of windows because they do not + have an icon representing them on the taskbar + + Copyright 2020 PySimpleGUI.org +""" + + +# If not running 4.28.0.4+ that has the DarkGrey8 theme, then uncomment to get it added. +# DarkGrey8 = {'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, +# } +# +# sg.theme_add_new('DarkGrey8', DarkGrey8) + +def title_bar(title): + bg = sg.theme_input_background_color() + + return [sg.Col([[sg.T(title, background_color=bg )]], pad=(0, 0), background_color=bg), + sg.Col([[sg.Text('❎', background_color=bg, enable_events=True, key='Exit')]], element_justification='r', k='-C-', pad=(0, 0), background_color=bg)] + + +def main(): + sg.theme('DarkGrey8') # Requires 4.28.0.4 or the code at the tiop + layout = [ + title_bar('Window Title'), + [sg.T('This is normal window text. The above is the fake "titlebar"')], + [sg.T('Input something:')], + [sg.Input(key='-IN-'), sg.Text(size=(12,1), key='-OUT-')], + [sg.Button('Go')] ] + + window = sg.Window('Window Title', layout, no_titlebar=True, grab_anywhere=True, keep_on_top=True, margins=(0,0), finalize=True) + + window['-C-'].expand(True, False, False) + + while True: # Event Loop + event, values = window.read() + print(event, values) + if event == sg.WIN_CLOSED or event == 'Exit': + break + if event == 'Go': + window['-OUT-'].update(values['-IN-']) + window.close() + +if __name__ == '__main__': + main()