Changed use of keyword "k" to key for better portability to older versions of PySimpleGUI. More example titlebar color setups

This commit is contained in:
PySimpleGUI 2020-08-13 19:58:48 -04:00
parent 1b1ca99275
commit 3261b96d46
1 changed files with 6 additions and 4 deletions

View File

@ -24,7 +24,7 @@ import PySimpleGUI as sg
# 'PROGRESS': ('#505F69', '#32414B'), # 'PROGRESS': ('#505F69', '#32414B'),
# 'BORDER': 1, 'SLIDER_DEPTH': 0, 'PROGRESS_DEPTH': 0, # 'BORDER': 1, 'SLIDER_DEPTH': 0, 'PROGRESS_DEPTH': 0,
# } # }
#
# sg.theme_add_new('DarkGrey8', DarkGrey8) # sg.theme_add_new('DarkGrey8', DarkGrey8)
@ -56,7 +56,7 @@ def title_bar(title, text_color, background_color):
tc = text_color tc = text_color
return [sg.Col([[sg.T(title,text_color=tc, background_color=bc )]], pad=(0, 0), background_color=bc), return [sg.Col([[sg.T(title,text_color=tc, background_color=bc )]], pad=(0, 0), background_color=bc),
sg.Col([[sg.T('_', text_color=tc, background_color=bc, enable_events=True, key='-MINIMIZE-'),sg.Text('', text_color=tc, background_color=bc, enable_events=True, key='Exit')]], element_justification='r', k='-C-', pad=(0, 0), background_color=bc)] sg.Col([[sg.T('_', text_color=tc, background_color=bc, enable_events=True, key='-MINIMIZE-'),sg.Text('', text_color=tc, background_color=bc, enable_events=True, key='Exit')]], element_justification='r', key='-C-', pad=(0, 0), background_color=bc)]
@ -67,8 +67,10 @@ def main():
sg.theme('DarkGrey8') sg.theme('DarkGrey8')
title = 'Customized Titlebar Window' title = 'Customized Titlebar Window'
# Here the titlebar colors are based on the theme. A few suggestions are shown. Try each of them
layout = [ title_bar(title, sg.theme_button_color()[0], sg.theme_button_color()[1]), layout = [ title_bar(title, sg.theme_button_color()[0], sg.theme_button_color()[1]),
# title_bar(title, sg.theme_button_color()[1], sg.theme_slider_color()),
# title_bar(title, sg.theme_slider_color(), sg.theme_button_color()[0]),
[sg.T('This is normal window text. The above is the fake "titlebar"')], [sg.T('This is normal window text. The above is the fake "titlebar"')],
[sg.T('Input something:')], [sg.T('Input something:')],
[sg.Input(key='-IN-'), sg.Text(size=(12,1), key='-OUT-')], [sg.Input(key='-IN-'), sg.Text(size=(12,1), key='-OUT-')],