From 8a3e33c70ef4409039f3a818925bfa0a3f6aff21 Mon Sep 17 00:00:00 2001 From: PySimpleGUI Date: Thu, 11 Mar 2021 09:07:42 -0500 Subject: [PATCH] Added a custom titlebar --- DemoPrograms/Demo_Simple_Material_Feel.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/DemoPrograms/Demo_Simple_Material_Feel.py b/DemoPrograms/Demo_Simple_Material_Feel.py index 9d821689..ea9d59c2 100644 --- a/DemoPrograms/Demo_Simple_Material_Feel.py +++ b/DemoPrograms/Demo_Simple_Material_Feel.py @@ -16,6 +16,9 @@ def make_window(light_mode): sg.theme('light grey') else: sg.theme('black') + BLUE = '#2196f2' + DARK_GRAY = '#212021' + LIGHT_GRAY = '#e0e0e0' BLUE_BUTTON_COLOR = '#FFFFFF on #2196f2' GREEN_BUTTON_COLOR ='#FFFFFF on #00c851' LIGHT_GRAY_BUTTON_COLOR = f'#212021 on #e0e0e0' @@ -35,7 +38,12 @@ def make_window(light_mode): [sg.Image(k='-GIF-', metadata=0)], [sg.T('The end of "my App"')]], element_justification='c', k='-TOP COL-')]] - window = sg.Window('Window Title', layout, grab_anywhere=True, no_titlebar=True) + layout = [[sg.Titlebar('Material Design Custom Titlebar', + background_color=BLUE if light_mode else DARK_GRAY, + text_color='white' if light_mode else LIGHT_GRAY, + k='-TITLEBAR-')]] + layout + + window = sg.Window('Window Title', layout) return window @@ -56,8 +64,8 @@ def main(): show_animation = True window['-GIF-'].metadata = 0 elif event == 'Upgrade': - sg.popup_no_titlebar('This is where you would do', 'the updagrade window code', background_color='black', text_color='white') - if event == 'Light' and not light_mode or event == 'Dark' and light_mode: + sg.popup('This is where you would do', 'the upgrade window code') + elif event == 'Light' and not light_mode or event == 'Dark' and light_mode: light_mode = not light_mode window.close() window = make_window(light_mode)