Combo element FINALLY gets really nice theme colors all the way through! (Thank you Jason!)

This commit is contained in:
PySimpleGUI 2022-05-03 13:30:22 -04:00
parent c20c71601e
commit e16545a991
1 changed files with 18 additions and 1 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/python3
version = __version__ = "4.59.0.37 Released 5-Apr-2022"
version = __version__ = "4.59.0.38 Released 5-Apr-2022"
_change_log = """
Changelog since 4.59.0 released to PyPI on 5-Apr-2022
@ -132,6 +132,9 @@ _change_log = """
4.59.0.37
Added back the filetypes parameter availability for the mac for the file browse operations. Was previously (incorrectly evidently!) removed for FileBrowse operations
(Thank you resnbl for all the help!)
4.59.0.38
Combo element finally gets drop-down list formatting (thank you Jason!)
"""
__version__ = version.split()[0] # For PEP 396 and PEP 345
@ -15558,6 +15561,7 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
combostyle.configure(style_name, arrowcolor=element.button_arrow_color)
if element.button_background_color not in (None, COLOR_SYSTEM_DEFAULT):
combostyle.configure(style_name, background=element.button_background_color)
except Exception as e:
_error_popup_with_traceback('Combo Element error {}'.format(e),
'Combo element key: {}'.format(element.Key),
@ -15570,6 +15574,19 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
element.TKCombo = element.Widget = ttk.Combobox(tk_row_frame, width=width, textvariable=element.TKStringVar, font=font, style=style_name)
# make tcl call to deal with colors for the drop-down formatting
try:
if element.BackgroundColor not in (None, COLOR_SYSTEM_DEFAULT) and \
element.TextColor not in (None, COLOR_SYSTEM_DEFAULT):
element.Widget.tk.eval(
'[ttk::combobox::PopdownWindow {}].f.l configure -foreground {} -background {} -selectforeground {} -selectbackground {}'.format(element.Widget,
element.TextColor,
element.BackgroundColor,
element.BackgroundColor,
element.TextColor))
except Exception as e:
pass # going to let this one slide
# Chr0nic
element.TKCombo.bind("<Enter>", lambda event, em=element: testMouseHook2(em))
element.TKCombo.bind("<Leave>", lambda event, em=element: testMouseUnhook2(em))