commit
b631111070
|
@ -1,6 +1,7 @@
|
||||||
import PySimpleGUI as sg
|
import PySimpleGUI as sg
|
||||||
|
|
||||||
def color_chooser():
|
|
||||||
|
def popup_color_chooser(look_and_feel=None):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
:return: Any(str, None) Returns hex string of color chosen or None if nothing was chosen
|
:return: Any(str, None) Returns hex string of color chosen or None if nothing was chosen
|
||||||
|
@ -658,9 +659,13 @@ def color_chooser():
|
||||||
'YellowGreen': '#9ACD32',
|
'YellowGreen': '#9ACD32',
|
||||||
}
|
}
|
||||||
|
|
||||||
sg.change_look_and_feel('Dark Blue 3')
|
old_look_and_feel = sg.CURRENT_LOOK_AND_FEEL
|
||||||
|
if look_and_feel is None:
|
||||||
|
look_and_feel = sg.CURRENT_LOOK_AND_FEEL
|
||||||
|
sg.change_look_and_feel(look_and_feel)
|
||||||
|
|
||||||
button_size = (1, 1)
|
button_size = (1, 1)
|
||||||
|
|
||||||
# button_size = (None,None) # for very compact buttons
|
# button_size = (None,None) # for very compact buttons
|
||||||
|
|
||||||
def ColorButton(color):
|
def ColorButton(color):
|
||||||
|
@ -691,6 +696,7 @@ def color_chooser():
|
||||||
window['-OUT-'](f'You chose {event[0]} : {event[1]}')
|
window['-OUT-'](f'You chose {event[0]} : {event[1]}')
|
||||||
color_chosen = event[1]
|
color_chosen = event[1]
|
||||||
window.close()
|
window.close()
|
||||||
|
sg.change_look_and_feel(old_look_and_feel)
|
||||||
return color_chosen
|
return color_chosen
|
||||||
|
|
||||||
|
|
||||||
|
@ -705,6 +711,8 @@ if __name__ == '__main__':
|
||||||
break
|
break
|
||||||
if event.startswith('Color'):
|
if event.startswith('Color'):
|
||||||
window.hide()
|
window.hide()
|
||||||
color_chosen = color_chooser()
|
color_chosen = popup_color_chooser('Dark Blue 3')
|
||||||
window['-CHOICE-'].update(color_chosen)
|
window['-CHOICE-'].update(color_chosen)
|
||||||
window.un_hide()
|
window.un_hide()
|
||||||
|
else:
|
||||||
|
print(f'The current look and feel = {sg.CURRENT_LOOK_AND_FEEL}')
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
version = __version__ = "4.7.1.2 Unreleased - included 4.7.1 patch, ability to update ttk buttons, images for ttk buttons"
|
version = __version__ = "4.7.1.3 Unreleased - included 4.7.1 patch, ability to update ttk buttons, images for ttk buttons, CURRENT_LOOK_AND_FEEL variable"
|
||||||
port = 'PySimpleGUI'
|
port = 'PySimpleGUI'
|
||||||
|
|
||||||
# 888888ba .d88888b oo dP .88888. dP dP dP
|
# 888888ba .d88888b oo dP .88888. dP dP dP
|
||||||
|
@ -223,6 +223,8 @@ if sys.platform == 'darwin':
|
||||||
else:
|
else:
|
||||||
DEFAULT_BUTTON_COLOR = ('white', BLUES[0]) # Foreground, Background (None, None) == System Default
|
DEFAULT_BUTTON_COLOR = ('white', BLUES[0]) # Foreground, Background (None, None) == System Default
|
||||||
OFFICIAL_PYSIMPLEGUI_BUTTON_COLOR = ('white', BLUES[0]) # Colors should never be this long
|
OFFICIAL_PYSIMPLEGUI_BUTTON_COLOR = ('white', BLUES[0]) # Colors should never be this long
|
||||||
|
CURRENT_LOOK_AND_FEEL = 'Default'
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_ERROR_BUTTON_COLOR = ("#FFFFFF", "#FF0000")
|
DEFAULT_ERROR_BUTTON_COLOR = ("#FFFFFF", "#FF0000")
|
||||||
DEFAULT_BACKGROUND_COLOR = None
|
DEFAULT_BACKGROUND_COLOR = None
|
||||||
|
@ -10706,6 +10708,8 @@ def ChangeLookAndFeel(index, force=False):
|
||||||
:param force: (bool) if True allows Macs to use the look and feel feature. Otherwise Macs are blocked due to problems with button colors
|
:param force: (bool) if True allows Macs to use the look and feel feature. Otherwise Macs are blocked due to problems with button colors
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
global CURRENT_LOOK_AND_FEEL
|
||||||
|
|
||||||
# if sys.platform.startswith('darwin') and not force:
|
# if sys.platform.startswith('darwin') and not force:
|
||||||
# print('*** Changing look and feel is not supported on Mac platform ***')
|
# print('*** Changing look and feel is not supported on Mac platform ***')
|
||||||
# return
|
# return
|
||||||
|
@ -10734,7 +10738,7 @@ def ChangeLookAndFeel(index, force=False):
|
||||||
print('Instead, please enjoy a random Theme named {}'.format(list_of_look_and_feel_values()[ix]))
|
print('Instead, please enjoy a random Theme named {}'.format(list_of_look_and_feel_values()[ix]))
|
||||||
|
|
||||||
selection = list_of_look_and_feel_values()[ix]
|
selection = list_of_look_and_feel_values()[ix]
|
||||||
|
CURRENT_LOOK_AND_FEEL = selection
|
||||||
try:
|
try:
|
||||||
colors = LOOK_AND_FEEL_TABLE[selection]
|
colors = LOOK_AND_FEEL_TABLE[selection]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue